In a regex, $ does not mean "end of string". It means "end of line", which is just before \n or the end of the string (whichever comes first). If you want to match the null string at the end of the string, use \z.
$ behaves like (?=\z|\n).$_ = "foo\n"; /^foo$/; # true /^foo\z/; # false /^foo\n$/; # true /^foo\n\z/; # true
U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk
In reply to Re: String Newline Question
by Juerd
in thread String Newline Question
by insensate
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |