K
Kristof Bastiaensen
Hi,
here is another regexp behaviour which surprises me.
There may be some logic behind it, but I fail to see it...
irb(main):004:0> /(theone)?/.match(" theone").to_a
=> ["", nil]
irb(main):003:0> /(theone)?/.match("theone").to_a
=> ["theone", "theone"]
irb(main):005:0> / (theone)?/.match(" theone").to_a
=> [" theone", "theone"]
In the first case, it doesn't match "theone", but in
the second and third it does...
Could anyone explain this?
Kristof
here is another regexp behaviour which surprises me.
There may be some logic behind it, but I fail to see it...
irb(main):004:0> /(theone)?/.match(" theone").to_a
=> ["", nil]
irb(main):003:0> /(theone)?/.match("theone").to_a
=> ["theone", "theone"]
irb(main):005:0> / (theone)?/.match(" theone").to_a
=> [" theone", "theone"]
In the first case, it doesn't match "theone", but in
the second and third it does...
Could anyone explain this?
Kristof