Re: .NET Regex href
From: Robby (edmund_at_not.my.email.com)
Date: 12/13/04
- Next message: siddharth_jain_1_at_rediffmail.com: "setting Username&password while using DirectoryInfo()"
- Previous message: Clint: "Re: "Requested registry access is not allowed" and Web Service call"
- In reply to: Ryan Moore: ".NET Regex href"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 14 Dec 2004 10:18:15 +1300
You could add a grouping that has both the " and the ' like the following;
href\s*=\s*(?:["'](?<1>[^"']*)["']|(?<1>\\S+))
You need to add your escapes for C# strings. I am VB. :)
Robby
"Ryan Moore" <ryan@rymoore.com> wrote in message
news:e910aEV4EHA.604@TK2MSFTNGP10.phx.gbl...
>I am trying to write a regex expression which extracts all href links
> from a HTML page... I'm currently using the following:
>
> href\\s*=\\s*(?:\"(?<1>[^\"]*)\"|(?<1>\\S+))
>
> but it has a problem with hrefs enclosed in single quotes, such as:
>
> <a href='anotherpage.htm'>
>
> I'm not a regex guru, can anyone point me in the right direction?
>
> Thanks!
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
- Next message: siddharth_jain_1_at_rediffmail.com: "setting Username&password while using DirectoryInfo()"
- Previous message: Clint: "Re: "Requested registry access is not allowed" and Web Service call"
- In reply to: Ryan Moore: ".NET Regex href"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|