I want to split string for ">" but not when >> in JavaScript.
But once I am doing a split const words = str.split('>'); it is splitting >> as well.
Currently, after the split I look for "> >" and then substitute them with ">>".
How to implement it properly.
str.split(/>(?!>)/g)This will still split on the second of the two>s though.console.log('a>b>>c>d>>e>f;'.replaceAll('>>', '^^^').split('>').map(x => x.replace('^^^', '>>')));(NOTE: You may use a different temporary replacement-placeholder insteadof'^^^')