If I have understood correctly, you should stay away from regular expressions when it comes to finding stuff in HTML. What is a good alternative to that, which is built in to standard PHP?
In my particular case right now I want to find all the image tags with their src, alt, height and width attributes. Later I’d also want to find certain meta tags. Either way, how would you do this with PHP?
The PHP version on my webhost is currently 5.2.x.
The
DOMXPathobject allows you to run XPath queries against XML in PHP. XPath allows you to extract specific tags from XML documents. It is language neutral (like regular expressions) and practically every programming language supports it.