Sunday, 7 May 2017

JS regexp to split string based on character not preceded by backslash

I want to use the JS String split function to split this string based only on the commas ,, and not the commas preceded by backslashes /,. How can I do this?

'this,is\,a,\,string'.split(/,/)

This code splits it on all strings, I'm not sure how to get it to split just on the commas not preceded by backslashes.



via user779159

No comments:

Post a Comment