We need to match text from a user input, but specifically reject any tags that aren't <br>
.
From other stackoverflow posts I can find the opposite match to what I need (i.e. it matches the offending tags rather than the text and the other tag). Due to constraints we can't use negative logic to this for validation. The regex is:
<(?!\/?br(?=>|\s.*>))\/?.*?>
Is it possible to match the whole text if it only contains "normal" text and BR tags?
For example these should match:
bob
bob<br>bob
bob<br />bob
bob</br>
These should fail to match
bob<p>bob
bob<div>bob
bob</div>bob