# http://perlmonks.org/?node_id=1180396 use strict; use warnings; my $sa = 'random,junk no,one,cares about(I,Want,This,stuff) but, (not,this) stuff which&might have-random characters'; my $new= $sa =~ s/ (?: ^ .*? \( )? # swallow start till first opening paren ( [^,)]+ ) # match words (non-delimiters) ,? # swallow delimiter (?: \) .* $ )? # swallow first closing paren till EOL / $1 #/xgr; print "#$new";