in reply to how to search and replace the match with specific number of times in a string
Simplest would be to use a looping statement modifier.
$ perl -E ' > $str = q{abcabdaaa}; > say $str; > $str =~ s{a}{i} for 1 .. 3; > say $str;' abcabdaaa ibcibdiaa $
I hope this is helpful.
Cheers,
JohnGG
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to search and replace the match with specific number of times in a string
by JavaFan (Canon) on Jan 29, 2010 at 11:09 UTC | |
|
Re^2: how to search and replace the match with specific number of times in a string
by loki (Novice) on Jan 29, 2010 at 13:47 UTC | |
by Verillion (Initiate) on Jan 29, 2010 at 17:30 UTC | |
by markkawika (Monk) on Jan 29, 2010 at 19:26 UTC | |
by Ratazong (Monsignor) on Jan 29, 2010 at 14:07 UTC |