use strict; use warnings; my $str = q{"one","two", "not three" , ' four',"five " }; my @arr = $str =~ m {(?x) (?<=['"]) ([^,'"]+) (?=['"]) }g; print qq{-->$_<--\n} for @arr;