in reply to Re^3: Strange regex to test for newlines: /.*\z/
in thread Strange regex to test for newlines: /.*\z/
Obviously /\z/ matches the string "f\n", so why should it fail to match if I prepend it with something that matches the empty string? This should be independent of where the end of the string is considered to be.
And why does /.?\z/ match and /.*\z/ not?
If we expand that scheme, why does /.?.?\z/ match, and /.*.?\z/ not?
In all cases I'd expect .? and .* to be reduced to the empty string - why doesn't it happen?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Strange regex to test for newlines: /.*\z/
by shmem (Chancellor) on May 21, 2007 at 15:47 UTC | |
by demerphq (Chancellor) on May 21, 2007 at 23:42 UTC | |
by tinita (Parson) on May 22, 2007 at 08:20 UTC | |
by demerphq (Chancellor) on May 23, 2007 at 21:34 UTC |