Possible Duplicate:
RegEx match open tags except XHTML self-contained tags
I have a HTML page with
<a class="development" href="[variable content]">X</a>
The [variable content] is different in each place, the rest is the same.
What regexp will catch all of those links?
(Although I am not writing it here, I did try...)
What about the non-greedy version:
<a class="development" href="(.*?)">X</a>
Try this regular expression:
<a class="development" href="[^"]*">X</a>
Regexes are fundamentally bad at parsing HTML (see Can you provide some examples of why it is hard to parse XML and HTML with a regex? for why). What you need is an HTML parser. See Can you provide an example of parsing HTML with your favorite parser? for examples using a variety of parsers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With