in reply to Re^3: doubt in matchingin thread doubt in matching
uva, Try the below code,
use strict; use warnings; $_="thhheeee good boyy"; s/((\w)\2{1,})/\($1\)/gsi; print $_; __END__ t(hhh)(eeee) g(oo)d bo(yy) [download]
Regards,Velusamy R.