in reply to Need help with substitue /g
my $string = "(1,2,3) XXX (1,2,3)"; $string =~ s{(?<=XXX )(\(.*?\))}{ (my $x = $1) =~ s/(\d+)/'$1'/g; $x } +e; print "$string\n"; [download]