in reply to Re: how to search and replace the match with specific number of times in a string
in thread how to search and replace the match with specific number of times in a string

Note that doesn't work in the general case. For instance, suppose you want to replace first three sequences of whitespace with a single space.
s/\s+/ / for 1 .. 3;
would replace the first sequence three times.
  • Comment on Re^2: how to search and replace the match with specific number of times in a string
  • Download Code