I’m not a regex-master, but I’m looking for a regex that would give this result in js:
var regex = ...;
var result = '"a b", "c, d", e f, g, "h"'.match(regex);
and result would be
['"a b"', '"c, d"', 'e f', 'g', '"h"']
EDIT:
Escaped quotes don’t need to be handled. It’s for a tagging field, where users must be able to enter:
tag1, tag2
but also
“New York, USA”, “Boston, USA”
EDIT2:
Thank you for your amazingly quick answer minitech, that did the trick!
I’d just use a loop:
Note: requires
String#trim, which you can shiv as follows: