in reply to Re: Regex matching next occurrence or to the end of line.
in thread Regex matching next occurrence or to the end of line.

Many thanks for your response Eily. I have not used look-ahead assertions before. Useful stuff and it looks like what I need... I have had a reply from a colleague at work with a slight modification to the regex I was using. This works -

if ( $string_exp =~ m/\Q$placeholder\E(.*?)((\$\{)|\z)/ ) { print "\"$1\"\n"; }

This matches up to the next occurrence of the literal ${, otherwise to the end of the string.

Thanks again.