in reply to inserting string using regular expression
Note the use of + (1 or more matches) instead of * (0 or more).use warnings; use strict; my $s = 'xxx12xxxx345xxxxx6789xxxx'; $s =~ s/([0-9]+)/found$1/g; print "$s\n"; __END__ xxxfound12xxxxfound345xxxxxfound6789xxxx
|
|---|