The $ means end-of-line, not end-of-stringNope. That's only the case with the option /m enabled. Unless I misunderstand what you mean...? Which is not exactly very clear to me.
I think the OP's problem is that he used /PAT(.*?)$/ and expected to match the final newline as well. As the /$/ does match just before the final newline as well as at the very end of the string, the non-greediness makes it pick the shortest match, thereby leaving the newline alone. Drop the '?' to make it work.
In reply to Re: Re: newline behavior in Regular Expression
by bart
in thread newline behavior in Regular Expression
by asinghvi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |