$data =~ s<(?:{{.*?}}\K)?\n>{<br>\n}gs; print $data; [download]
In reply to Re: Replace newlines only if not inside braces by trizen in thread Replace newlines only if not inside braces by jbryan