This is quite a simple regex, but I can't get my head around how I'd expand this regex so that it would allow me to use my delimiter character as long as it is escaped in the string. Here's what I have:
// Contents of str is exactly '|1|2|\|Three and Four\||5'
str.match(/[^|]/);
// Looking for: ['1', '2', '|Three and Four|', '5']
So currently my regex selects everything that isn't a |
character and I get an array of each item. But what I want to do is to ignore the |
character as a separator if it has been escaped first with \
, but of course I don't want the \
to come through.
I know this'll be marked as a duplicate of the billion other regex questions, but I've tried to apply other solutions on here to my own, and played around with regex101.com. Alas, my Regex Fu is not strong.
P.s. Anyone know of any good resources to learn JS flavoured regex?