$_ = "'foo',123,'bar\\'cuz', 'comma,comma',,'void'"; map { my $t = $2 || $3; print "<$t\n"; } m/('(.*?)'|([^']*?))($|,\s*)/g; ______________ <'foo'