i have a text string
bus<br/>
How can I use regular expression in JavaScript to match any "b" characters except the b within the
html tag
i have a text string
bus<br/>
How can I use regular expression in JavaScript to match any "b" characters except the b within the
html tag
In most regex engines, to match b
except in <br/>
use negative look behind/ahead:
(?<!<)b(?!r/>)
See live demo.
However, javascript doesn't support look behinds. But it does support look aheads - you'll probably be OK with just:
b(?!r/>)
For this simplified version to fail, the input would have to contain br/>
(without the open angle braket), which seems unlikely.