in reply to minimal matching to end of string in regular expressions
So, in your case:/.*PAT/s;
You can also combine this with the \K construct:s/(.*)\).*/$1/s;
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.s/.*\K\).*//s
|
|---|