Is there a reason why you've put the \K within the group?
I suppose this does the same and is better readable!
$data =~ s<(?:{{.*?}})?\K\n>{<br>\n}gs; print $data;
Cheers Rolf
1) see or clause in Re: Replace newlines only if not inside braces for a work around
In reply to Re^2: Replace newlines only if not inside braces
by LanX
in thread Replace newlines only if not inside braces
by jbryan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |