RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find HTML Anchor (link) tag
Expression
<a\s+(?:(?:\w+\s*=\s*)(?:\w+|"[^"]*"|'[^']*'))*?\s*href\s*=\s*(?<url>\w+|"[^"]*"|'[^']*')(?:(?:\s+\w+\s*=\s*)(?:\w+|"[^"]*"|'[^']*'))*?>.+?</a>
Description
This regex will match all html link tags and captures the url into a named capture "url". There can be any html code between the opening and closing link tags. You must use this with the multiline and ignore case options selected.
Matches
Any html link (anchor) tag with any content between the opening and closing link tags
Non-Matches
all other html tags, link tags without an href section.
Author Rating: Not yet rated. Derek Pinkerton
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials