471,618 Members | 1,308 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Need Help with regular expression

hi guys,
i'm looking for a RegEx which can find these type of string from the
bunch of html lines. if any one can help me here, would be appriciated.

<a
href="/url?sa=p&pref=ig&pval=2&q=http://www.google.co.in/ig%3Fhl%3Den"
onmousedown="return rwt(this,'pro','hppphou:def','')">Personalized
Home</a>
<a
href="https://www.google.com/accounts/Login?continue=http://www.google.co.i...">Sign

in</a>
<a id=1a class=q href="/imghp?hl=en&tab=wi" onClick="return
qs(this);">Images</a>
<a id=2a class=q href="http://groups.google.co.in/grphp?hl=en&tab=wg"
onClick="return qs(this);">Groups</a>
<a id=4a class=q href="http://news.google.co.in/nwshp?hl=en&tab=wn"
onClick="return qs(this);">News</a>
<a href="/intl/en/options/" class=q>more&nbsp;&raquo;</a>
<a href=/advanced_search?hl=en>Advanced Search</a>
<a href=/preferences?hl=en>Preferences</a>
<a href=/language_tools?hl=en>Language Tools</a>
<a href="http://www.google.co.in/hi">Hindi</a>
<a href="http://www.google.co.in/bn">Bengali</a>
<a href="http://www.google.co.in/te">Telugu</a>
<a href="http://www.google.co.in/mr">Marathi</a>
<a href="http://www.google.co.in/ta">Tamil</a>
<a href="/ads/">Advertising&nbsp;Programs</a>
<a href=/intl/en/about.html>About Google</a>
<a href=/jobs/positions-in.html onmousedown="return
rwt(this,'pro','hppwebjob:en_in','')">We're Hiring</a>
<a href=http://www.google.com/ncr>Go to Google.com</a>
guys, please do help me. i'm in big trouble

Dec 29 '05 #1
2 2274
Could you be a little more specific? The example you have cited is not
clear enough. Regular expressions are used to match complex patterns
from a string
e.g. if you wanted to find all instances of "Windows 95" and "Windows
98" but not "Windows 2000"

If you want to find all instances of a specifc string, you are better
off using the string.IndexOf method.

Regards,
Sarin.

Lucky wrote:
hi guys,
i'm looking for a RegEx which can find these type of string from the
bunch of html lines. if any one can help me here, would be appriciated.

<a
href="/url?sa=p&pref=ig&pval=2&q=http://www.google.co.in/ig%3Fhl%3Den"
onmousedown="return rwt(this,'pro','hppphou:def','')">Personalized
Home</a>
<a
href="https://www.google.com/accounts/Login?continue=http://www.google.co.i...">Sign

in</a>
<a id=1a class=q href="/imghp?hl=en&tab=wi" onClick="return
qs(this);">Images</a>
<a id=2a class=q href="http://groups.google.co.in/grphp?hl=en&tab=wg"
onClick="return qs(this);">Groups</a>
<a id=4a class=q href="http://news.google.co.in/nwshp?hl=en&tab=wn"
onClick="return qs(this);">News</a>
<a href="/intl/en/options/" class=q>more&nbsp;&raquo;</a>
<a href=/advanced_search?hl=en>Advanced Search</a>
<a href=/preferences?hl=en>Preferences</a>
<a href=/language_tools?hl=en>Language Tools</a>
<a href="http://www.google.co.in/hi">Hindi</a>
<a href="http://www.google.co.in/bn">Bengali</a>
<a href="http://www.google.co.in/te">Telugu</a>
<a href="http://www.google.co.in/mr">Marathi</a>
<a href="http://www.google.co.in/ta">Tamil</a>
<a href="/ads/">Advertising&nbsp;Programs</a>
<a href=/intl/en/about.html>About Google</a>
<a href=/jobs/positions-in.html onmousedown="return
rwt(this,'pro','hppwebjob:en_in','')">We're Hiring</a>
<a href=http://www.google.com/ncr>Go to Google.com</a>
guys, please do help me. i'm in big trouble


Dec 29 '05 #2
okey dude,
ultimately i made one regEx by myself. here it is for all those who
are in need for the same

<a [a-zA-Z0-9 ="'.:;?]*href=*[a-zA-Z0-9 ="'.:;>?]*[^>]*>([a-zA-Z0-9
="'.:;>?]*[^<]*<)\s*/a\s*>
copy all the links from my last post into one string and run this
expression. it will show you the o/p that i wanted.

Dec 29 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Mike Andrews | last post: by
4 posts views Thread by Neri | last post: by
18 posts views Thread by Q. John Chen | last post: by
3 posts views Thread by Lucky | last post: by
17 posts views Thread by Mark | last post: by
14 posts views Thread by Chris | last post: by
reply views Thread by leo001 | last post: by
1 post views Thread by ZEDKYRIE | 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.