Title |
Test
Find
HTML Anchor
|
Expression |
<a (?:(?<ATTRIBUTES>[\w-]+=[\""\']?[\w\S ]+?[\""\'])[ ]+)*href=(?<QUOTE>[\""\'])?(?<URL>(?<SCHEME>(file|ftp|http|https|news|nntp):\/\/|mailto\:)?(?<EMAIL>[\w-]+@)?(?<HOST>(?(SCHEME)[\w]+(\.[\w-]+)*?))(?<PATH>\/?\w*[\w-%\:\.\+\/]+)?(?<QUERY>\?[\w-%\+:\.]*(=[\w-%\+:\.]*)?(&[\w-%\+\:\.]*(=[\w-%\+:\.]*)?)*)?(?<ANCHOR>\#[\w-%\+:\.]+)?)?(?<-QUOTE>[\""\'])?(?:[ ]+(?<ATTRIBUTES>[\w-]+=[\""\']?[\w\S ]+?[\""\']))*>(?<TEXT>.+?)<\/a>(?#VALIDATE QUOTES/URL)(?(PATH)|(?(SCHEME)|(?!)))(?(QUOTE)(?!)) |
Description |
Will match an HTML anchor and will include attributes. It will output various named groups. |
Matches |
<a target="_blank" class="cssLink" href="http://www.prize-pony.com/pcomp/solarxylophone/">Rory's</a> | <a href="/products/make12xphone/parts/">Bundle Parts</a> | <a href="/products/make12xphone/parts/" target="_blank">Bundle Parts</a> | <a href="mailto:[email protected]">example</a> | <a href="http://www.example.com">example</a> | <a href="https://localhost/bla-h3/?x%20#test1">test</a> | <a href='eek' class='testMe'>eek</a> | <a class="google" href="http://example.com/Search.aspx?k=href&c=-1&m=-1&ps=%20" target="_top">Search</a> | <a href="ftp://127.0.0.1">FTP</a> | <a class="google" href="http |
Non-Matches |
<a href="">asdas</a> | <a href=">asda2</a> | <a href=>asda3</a> | <a href="javascript: testMe();">testMe</a> | <a href="javascript: testMe();" extraText>testMe</a> | <a href="http://www.example.com" extraText>example</a> | <a href="bad example">bad example</a> |
Author |
Rating:
Not yet rated.
Eric Bouwsema
|
Source |
|
Your Rating |
|