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
In reply to Re: inserting string using regular expression
by toolic
in thread inserting string using regular expression
by MaxCarp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |