It sounds like you just want to modify the greediness of *:
The ? following the * will cause it to be non-greedy and thus match at the earliest possible point in the string rather than the latest.$content =~ s/(\w+)(: *)(.*?)\n<xxxxyyxxxx>\n/$1.":".$2.encode_base64( +$3,'')."\n"/ges;
In reply to Re^3: inline replacement in existing regex
by duff
in thread inline replacement in existing regex
by raiten
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |