in reply to Re: Junking excess string.. junk with s///.
in thread Junking excess string.. junk with s///.
Keeping that in mind, what your first example does is match as much as it can until it finds the last \n.
That is incorrect. The dot (".") does not match a newline.¹ Therefore, /^(.*)/ will capture everything up to the first newline, not the last one.
1. Unless the regex is modified with /s. The OP's was not.
-sauoq "My two cents aren't worth a dime.";
|
|---|