I just stumbled over the following effect and (trial-and error)
workaround:
p "abcxyxyxydef".split(/(xy)+/) #=> ["abc","xy","def"]
p "abcxyxyxydef".split(/(?:xy)+/) #=> ["abc","def"]
Why this difference?
···
--
Microsoft designed a user-friendly car:
instead of the oil, alternator, gas and engine
warning lights it has just one: "General Car Fault"
A capture in a split() Regexp is taken to indicate pieces of the separator you would like returned in the resulting set.
Hope that helps.
James Edward Gray II
···
On May 26, 2005, at 3:55 PM, Oliver Cromm wrote:
I just stumbled over the following effect and (trial-and error)
workaround:
p "abcxyxyxydef".split(/(xy)+/) #=> ["abc","xy","def"]
p "abcxyxyxydef".split(/(?:xy)+/) #=> ["abc","def"]
Why this difference?