use strict; use warnings; my $string = '1,2,a,b,3'; $string =~ s/( (?:(?