[#68478] Looking for MRI projects for Ruby Google Summer of Code 2015 — Tony Arcieri <bascule@...>

Hi ruby-core,

10 messages 2015/03/10

[ruby-core:68675] [Ruby trunk - Bug #11014] [Open] String#partition doesn't return correct result on zero-width match

From: janko.marohnic@...
Date: 2015-03-29 14:51:57 UTC
List: ruby-core #68675
Issue #11014 has been reported by Janko Marohni=C4=87.

----------------------------------------
Bug #11014: String#partition doesn't return correct result on zero-width ma=
tch
https://bugs.ruby-lang.org/issues/11014

* Author: Janko Marohni=C4=87
* Status: Open
* Priority: Normal
* Assignee:=20
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
First, to see how String#match works on my example:

~~~
match =3D "foo".match(/^=3D*/)
match.pre_match  #=3D> ""
match[0]         #=3D> ""
match.post_match #=3D> "foo"
~~~

Now, if I used String#partition instead of match, I'd expect to get `["", "=
", "foo"]` (pre_match, match, post_match). However

~~~
"foo".partition(/^=3D*/) #=3D> ["foo", "", ""]
~~~

String#rpartition returns the correct result (with the same regex).



--=20
https://bugs.ruby-lang.org/

In This Thread

Prev Next