tags:

views:

205

answers:

1

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
Note however, that this simple snippet does not account for escaped quotes inside the tokens.
chiborg