$ perl -le' my $string = q/423RY75Y69827EC67592C78657N965R345U299M/; print $string; $string =~ s/(([A-MO-Z])[\dN]+\2)/_$1_/ig; print $string; substr( $string, 1 + rindex $string, q/_/ ) =~ s/(?<=[^\dN\3])([\dN]+[ +A-MO-Z])/_$1/ig; print $string; ' 423RY75Y69827EC67592C78657N965R345U299M 423R_Y75Y_69827E_C67592C_78657N965R345U299M 423R_Y75Y_69827E_C67592C_78657N965R_345U_299M
In reply to Re: match if last char and first char are different excluding certain chars
by jwkrahn
in thread match if last char and first char are different excluding certain chars
by leocharre
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |