|
|
|
|
|
by codedokode
1435 days ago
|
|
Interesting. The reason for a bug seems to be that ^ and $ in regexps match a boundary of any line, not boundaries of a string. This have already caused problems in the past, as far as I remember, but Ruby developers didn't change the behaviour of these characters. So if you write a regexp like /^[0-9]$/, a string "Any characters\n12345\nAny characters" will match the regexp. |
|
because Ruby has \A and \Z to match the boundaries of a string