I’m going to be working with regular expression’s a lot in a new project,
I don’t have much experience with them and was wondering of a good way of converting HTML to a regular expression.
Anybody know of any good tutorials, or perhaps a generator?
At the moment I need to convert this:
<span class="code" id="code" title="DOESNT MATTER">IMPORTANT<img class="scissors" src="DOESNT MATTER" alt="DOESNT MATTER" /></span>
Thanks!
If you want to just get rid of all the html around some values, you can just use strip_tags()
Edit: moved the comment into the answer because it was copy/pasting out bad.
Also, please note that just like said in the comments above, using a regex to parse html is considered bad practice. You should be able to load the html into an instance of DOMDocument and use the getElementsByTagName method to get all spans. Then you can loop through those and validate the attributes/text inside.