I need to parse expression like 'a' 'b' 'cd ef' three tokens how can this be done in javascript?par
+1
A:
var re = /'([^']*)'/g;
var input = "'foo' 'bar' 'omg wtf'";
var hit;
while (hit = re.exec(input)) {
print(hit[1]);
}
just somebody
2009-11-17 05:44:55
Note however, that this simple snippet does not account for escaped quotes inside the tokens.
chiborg
2010-07-07 21:17:15