It's been quite a few hours now and I can't figure this out. I'm not good at all at regex but I don't understand.
Using Javascript I'm trying to split the following string at /
(front slash) but ignoring html tag such as </
.
html(string).split("regex")
Example string:
Area <span>base</span> × Height/3
output expected:
Area <span>base</span> × Height/3
^
selected
outputArray = ["Area <span>base</span> × Height", "3"]
I'm trying with this regex:(?!</+)(/)
but is not working.
I also tried with this that I got from the internet (/)(?<!</?[^>]*|&[^;]*)
and (?<!<)([\/\\])
which "works" in regexr.com but is not actually working in the browser since it uses negative lookbehind.
EDIT:
I also tried with \/(?!.*>)
and works in the regex checker but not in browser.
EDIT2:
The above regex did worked, I was adding the regex in the split function with quotes but it's just .split(/\/(?!.*>)/g)