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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details Pattern Title
Expression
<a\s*href=(.*?)[\s|>]
Description
Retrieves all anchor links in a html document, useful for spidering. You will need to do a replace of " and ' after the regular expression, as the expression gets all links. As far as I know there is no way, even with \1 groupings, of getting a condition on whether the link contains a ",' or nothing at all (" and ' is easy enough, but what happens if the link starts with ", and has a javascript function call with a string in it). If there is, it's probably quicker to do it like this and do a string replace anyway.
Matches
<a href="http://www.blah.com"> | <a href='../blah.html' target="_top"&a
Non-Matches
<a href = http://www.idiothtmlprogrammers.com >
Author Rating: The rating for this expression. chris s
   Displaying page 1 of 1 pages; Items 1 to 1

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