I'm trying to find a way to spilt a string into single words OR phrases where the phrase is enclosed in quotes. For example:
javascript 'sql server' vbscript
would be split into:
- javascript
- sql server
- vbscript
I got help yesterday with this question which splits the string into single words using
/[-\w]+/g
I've been wrestling with the dark art of regular expressions and found this question which does a similar thing in php but even with the explanation it still doesn't make a great deal of sense to me (and doesn't work when I copy/paste into javascript!)
/"(?:\\\\.|[^\\\\"])*"|\S+/
Any help appreciated even a pointer to an easy to understand guide to regular expressions!