I’ve got strings in the form of:
/path/ /path\ with\ space/ /another/
I need to split this so I end up with an array containing:
[ /path/, /path with space/, /another/ ]
Is there an easy regex that would take care of this? Previously I was using \s+ but obviously that doesn’t work here.
Use a negative lookbehind.
Note that the second element still contains
\s, which you’ll need to strip out yourself.Yes, that’s four
\s just to match a single one in the string.