http://qs321.pair.com?node_id=565868


in reply to Matching quote characters?

The object is to get the shortest possible string that starts with " and ends with either " or the end of the sample. So:
while (<DATA>) { chomp; print "$1\n" while m/(".*?(?:"|$))/g; } __DATA__ abc "def "ghi" jkl" mno"pqr"stu v"wx"y"z"