"thhheeee good boyy" should be "t(hhh)(eeee) g(oo)d bo(yy)"In that case, maybe you want something like this:
Output:#!/usr/bin/perl -w use strict; while (<DATA>) { chomp; $_ =~ s/(\w)(\1+)/\($1$2\)/g; print "$_\n"; } __DATA__ thhheeee good boyy the qqquick brrrowwwn fooox
Cheers,t(hhh)(eeee) g(oo)d bo(yy) the (qqq)uick b(rrr)o(www)n f(ooo)x
In reply to Re^4: doubt in matching
by McDarren
in thread doubt in matching
by uva
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |