acadenilla
asked on
Regular Expression
Hi
Any body know a nice regular expression that matches and gets <a> tags
IE if i have a document i would like to extract all the <a> assuming that the <a> has an ending tag (</a>)
Thanks
Allan
Any body know a nice regular expression that matches and gets <a> tags
IE if i have a document i would like to extract all the <a> assuming that the <a> has an ending tag (</a>)
Thanks
Allan
ASKER
bruce
I fails when i tried a simple link
<a href='asdfasdf.com'>first tag text</a>
could you explain to me the expression
I might need to handle some crazy link ie
<a id='asdfas' onmouseclick='asdfasdf' href='asdfasdf'><font><b>a sdfasdfas< /b><font>< /a>
or
<a href='aasdfasdf'><img></im g></a>
thanks
I fails when i tried a simple link
<a href='asdfasdf.com'>first tag text</a>
could you explain to me the expression
I might need to handle some crazy link ie
<a id='asdfas' onmouseclick='asdfasdf' href='asdfasdf'><font><b>a
or
<a href='aasdfasdf'><img></im
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just leave away the ?<text> and use
<(?<a>\w*)>(.*)</\k<a>>
<(?<a>\w*)> check for <a followed by any alphanummeric value, hast to close with >
(.*) any number or character is allowed, any number of repetition
</\k<a>> has to end with </a>
<(?<a>\w*)>(.*)</\k<a>>
<(?<a>\w*)> check for <a followed by any alphanummeric value, hast to close with >
(.*) any number or character is allowed, any number of repetition
</\k<a>> has to end with </a>
Regards,
Bruce