|Welcome to the Monastery|
repeated characters in regular expressionsby AmnonM (Initiate)
|on Aug 01, 2013 at 07:25 UTC||Need Help??|
AmnonM has asked for the
wisdom of the Perl Monks concerning the following question:
I want to look through a string, and if I find n repeated characters, I want to replace them with m of the same character. Probably a simple regexp for a monk?
e.g., if n=4 and m=1 then... p8888er9999l --> p8er9l
if n=1 and m=3 monks --> mmmooonnnkkksss