There's more than one way to do things | |
PerlMonks |
Re: minimal matching to end of string in regular expressionsby JavaFan (Canon) |
on Mar 04, 2012 at 11:43 UTC ( [id://957765]=note: print w/replies, xml ) | Need Help?? |
In general, if you want to find the last pattern in a string:
So, in your case: You can also combine this with the \K construct: BTW, your question makes it unclear to me whether you want to trailing newline to be removed. My code does, and your "want it to be" does not include a newline -- but your original solution does.
In Section
Seekers of Perl Wisdom
|
|