I′ve got a problem that I have to remove all HTML br tags in an unordered list. The input HTML looks like this
<br /><ul><br /><li>one</li><br /><li>two</li><br /></ul><br />
Now I have to remove the br tags in the unordered list (and not the ones before and following)
I tried to solve the problem via regular expressions
(?<=(<ul.*>))(.*)(?=(</ul>))
That gives me the text between the ul tags.
But how can I get only the br tags in the selection?
https://regexr.com/5jo2s
Thank you very much in advance!
The solution from Wiktor Stribizew (see above) is working
/(?<=<ul[^>]*>.*?)<br />(?=.*?</ul>)/g
2.1m questions
2.1m answers
60 comments
56.9k users