Title says it I guess, I want to match all </li> tags not proceeded <br/>, my try was this:
^(?!<br\/>$).*$<li>
but it won't work. Any tipps?
Title says it I guess, I want to match all </li> tags not proceeded <br/>, my try was this:
^(?!<br\/>$).*$<li>
but it won't work. Any tipps?
You don't need that .*$ in between. Specially that anchor is doing the danger. In fact you don't need anchors at all in the regex, unless you are testing for <br /> at the beginning of the string.
And you are testing against <li> and not </li>.
Also (?!...) is for negative look-ahead. For look-behind, you should use: (?<!...)
Try using this regex:
"(?<!<br/>)</li>" // You don't need to escape `/`
Note that, for more complicated cases of HTML parsing, you should avoid using Regex. Use an HTML parser instead. For Java, you can take a look at - JSoup
` anywhere before the `