in reply to Substitute for variable-length look-behind?
I ran with a combination of Roy, tye, and Zaxo. s///e to get multiple lvalues into a string (one lvalue per line in the string), then Roy's idea to walk pos() in that line followed up with some modifications to substr() lvalues.
s(^(.+?\Q$RESET | \E)(.+)){ my $header = $1; my $comment = $2; $comment =~ s((?: <code> (.*?) </ code> | \[ (.*?) \] | (<!-- .*? -->) )){ ( ( defined( $1 ) && ( GREEN . $1 ) ) || ( defined( $2 ) && ( RED . $2 ) ) || ( defined( $3 ) && ( YELLOW . $3 ) ) ) . RESET }gex; "$header$comment"; }meg;
|
---|