Regular Expressions - text link

Cheetah

Well-known member
Joined
Oct 12, 2006
Messages
232
Programming Experience
Beginner
Hi there,

Does anyone know any good tutorials for learning these as I feel its something i should learn.

Also - What would be the regex for anything for a text hyperlink. So it would pick up this:

VB.NET:
<a href="#">Hyperlink</a>

...but it wouldn't pick up this:

VB.NET:
<a href="#"><img src="/image.jpg" alt="" /></a>

This is as far as i have got:

VB.NET:
<a (.|\n)+?>\w*<\/a>

Thanks.
 
Last edited:
I just found this url, http://regexlib.com/Default.aspx. Enter keyword hyperlink in the textbox provided and you will get regex patterns. This one seems to be better

VB.NET:
 <a\s{1}href="(?<url>.*?)"(\s?target="(?<target>_(blank|new|parent|self|top))")?(\s?class="(?<class>.*?)")?(\s?style="(?<style>.*?)")?>(?<title>.*?)</a>
 
Back
Top