471,309 Members | 1,080 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,309 software developers and data experts.

Need one Regular Expression - Urgent

hi guys,
i'm looking for one RegEx which can find matches from the bunch of
lines. i want to find all the matches of "<a * href=*>*</a>". if any
one can help me out here, please do come forward.
thanks,
Lucky

Dec 29 '05 #1
6 1071
Lucky,

If you have a reply, pleas, don't than split it up between more messages.
Reply to yourself with the addition.

Cor
Dec 29 '05 #2
You might want to check at www.regexlib.com

"Lucky" <tu************@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
hi guys,
i'm looking for one RegEx which can find matches from the bunch of
lines. i want to find all the matches of "<a * href=*>*</a>". if any
one can help me out here, please do come forward.
thanks,
Lucky
Dec 29 '05 #3

"Lucky" <tu************@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
hi guys,
i'm looking for one RegEx which can find matches from the bunch of
lines. i want to find all the matches of "<a * href=*>*</a>". if any
one can help me out here, please do come forward.


"\<a * href=*\>*\</a\>" in MSWord

"\<a .* href=.*\>.*\</a\>" in Unix IIRC. Be aware this won't find "<a *
Href=*>*</A>"

VB Net may differ.

Dec 30 '05 #4
In the general case this can not be done with regular expressions,
because the <a> element can contain markup itself. You need an HTML
parser for this problem. As far as I can tell Microsoft is of no help
here. If you can consider other languages, there are well-tested
solutions for Perl, Python, and Ruby. For C# I found this link:
http://www.developer.com/net/csharp/article.php/2230091

Dec 30 '05 #5
(?i)<(a{1}?)[^>]*href=[^>]*[>]?(.*?)(?:</\1|/)>{1}?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Homer J Simpson" <no****@nowhere.com> wrote in message
news:qW1tf.14341$6K2.14268@edtnps90...

"Lucky" <tu************@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
hi guys,
i'm looking for one RegEx which can find matches from the bunch of
lines. i want to find all the matches of "<a * href=*>*</a>". if any
one can help me out here, please do come forward.


"\<a * href=*\>*\</a\>" in MSWord

"\<a .* href=.*\>.*\</a\>" in Unix IIRC. Be aware this won't find "<a *
Href=*>*</A>"

VB Net may differ.

Dec 30 '05 #6

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:un*************@TK2MSFTNGP11.phx.gbl...
(?i)<(a{1}?)[^>]*href=[^>]*[>]?(.*?)(?:</\1|/)>{1}?


Not bad, but a{1} is redundant

Dec 31 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by learner | last post: by
4 posts views Thread by Buddy | last post: by
18 posts views Thread by Q. John Chen | last post: by
7 posts views Thread by Billa | last post: by
3 posts views Thread by Lucky | last post: by
14 posts views Thread by Chris | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.