while (m(<code>|\[|<!--)g) { if ($& eq '<code>') { s{\G(.+?)</ code>}{$GREEN$1$RESET}; pos($_) += length("$GREEN$1$RESET"); } elsif ($& eq '[') { s{\G(.+?)\]}{$RED$1$RESET}; pos($_) += length("$RED$1$RESET"); } elsif ($& eq '<!--') { s{\G(.+?)-->}{$YELLOW<!--$1$-->RESET}; pos($_) += length("$YELLOW$1$RESET"); } }
In reply to Re: Substitute for variable-length look-behind?
by Roy Johnson
in thread Substitute for variable-length look-behind?
by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |