G
Gary Yngve
[Note: parts of this message were removed to make it a legal post.]
Just got bitten by some functionality of split w/ grouped patterns:
(in ruby 1.8.6...)
The 1.8 docs are silent on this, but the 1.9 docs at least say
"If pattern contains groups, the respective matches will be returned in the
array as well. "
This "feature" surprised the heck out of me.. Anyone know if this
functionality is intentional (from the enduser standpoint), or rather a
byproduct of implementation details?
Anyhoo, if anyone else gets weird behavior for string split including the
pattern, or with groups in the pattern, maybe you'll remember this or maybe
google will tell you about this.
Thanks,
-Gary
Just got bitten by some functionality of split w/ grouped patterns:
(in ruby 1.8.6...)
=> ["foo ", "bar", " baz"]"foo bar baz".split(/bar/) => ["foo ", " baz"]
"foo bar baz".split(/(bar)/)
The 1.8 docs are silent on this, but the 1.9 docs at least say
"If pattern contains groups, the respective matches will be returned in the
array as well. "
This "feature" surprised the heck out of me.. Anyone know if this
functionality is intentional (from the enduser standpoint), or rather a
byproduct of implementation details?
Anyhoo, if anyone else gets weird behavior for string split including the
pattern, or with groups in the pattern, maybe you'll remember this or maybe
google will tell you about this.
Thanks,
-Gary