I have this code here:
var fields = row.split(/regex goes here/);
I want to split row on each occurrence of
|
but not
*|
How do I write this simple regular expression. I thought there was a not character of sorts but I can’t seem to find a good reference right now.
I know I need to escape the special character | like this \|..but how do I add the not part?
Likely I will just switch my markup to
|*
instead of
*|
and than I can this form I found on MDN – match x only if not followed by y.
x(?!y)
I’m testing here:
Found a good reference here
Don’t
split()on the delimiter. Just.match()everything between delimiters:Explanation: