September 20th, 2009, 08:01 AM
Match HTML tags with specified attributes?
I'm a newbie with Regex so I'm confused about how to match HTML opening tags with specified attributes. Eg I want to match "div" elements that have those attributes only : style, class, id. If at least one of the attributes is not found or other attributes appear then the tags will not be matched. Anyone could help me please? Thanks so much.
I'm using PHP.
September 21st, 2009, 01:42 AM
September 21st, 2009, 02:28 AM
I agree - you do not want to parse HTML or XML with regex - that way lies madness. There are lots of alternative ways of getting data from HTML/XML files such as DOM parsers, SAX parsers and xpath. If your language does not support any of them then you are using the wrong language.