How can convert the "-" to list (li) on PHP? Example HTML:
any text - any text any text any text any text any text
<br><br>- any text any text<br>- any text 1 2 3 | \ ,<br><br>
<br>any text
I tried using the following regex:
(<\s*[^>]*>-\s?(.*?)<\s*[^>]*>)
But then only the first match can be found...
By this can find everything what I need - that start from the <br>
tag, but it cannot set the end of the search (it will be in the <br>
tag):
<br>\s?-\s?(.*?)
(link to test: https://regex101.com/r/CqjpzX/1 ).
I'm not 100% sure this is what you're asking for, but if you want to capture everything between the <br>-
and <br>
you need to use a regex like this.
<br>\s?-\s?(.*?)(?=<br>)
Here is an example on your text https://regex101.com/r/71cHQB/1
I hope this can help you.
Also don't forget the /g after the regex so it doesn't stop after the first match.