473,576 Members | 3,395 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=i g&pval=2&q=http ://www.google.co.i n/ig%3Fhl%3Den"
onmousedown="re turn rwt(this,'pro', 'hppphou:def',' ')">Personalize d
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);">Imag es</a>
<a id=2a class=q href="http://groups.google.c o.in/grphp?hl=en&tab =wg"
onClick="return qs(this);">Grou ps</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&nb sp;&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.i n/hi">Hindi</a>
<a href="http://www.google.co.i n/bn">Bengali</a>
<a href="http://www.google.co.i n/te">Telugu</a>
<a href="http://www.google.co.i n/mr">Marathi</a>
<a href="http://www.google.co.i n/ta">Tamil</a>
<a href="/ads/">Advertising&n bsp;Programs</a>
<a href=/intl/en/about.html>Abou t Google</a>
<a href=/jobs/positions-in.html onmousedown="re turn
rwt(this,'pro', 'hppwebjob:en_i n','')">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 2325
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=i g&pval=2&q=http ://www.google.co.i n/ig%3Fhl%3Den"
onmousedown="re turn rwt(this,'pro', 'hppphou:def',' ')">Personalize d
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);">Imag es</a>
<a id=2a class=q href="http://groups.google.c o.in/grphp?hl=en&tab =wg"
onClick="return qs(this);">Grou ps</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&nb sp;&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.i n/hi">Hindi</a>
<a href="http://www.google.co.i n/bn">Bengali</a>
<a href="http://www.google.co.i n/te">Telugu</a>
<a href="http://www.google.co.i n/mr">Marathi</a>
<a href="http://www.google.co.i n/ta">Tamil</a>
<a href="/ads/">Advertising&n bsp;Programs</a>
<a href=/intl/en/about.html>Abou t Google</a>
<a href=/jobs/positions-in.html onmousedown="re turn
rwt(this,'pro', 'hppwebjob:en_i n','')">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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4348
by: Danny | last post by:
I am trying to do a regular expression to search for a url so anything that has http:\\www.hellothere.com but may not have the http:\\ and may not have the www and may not have http:\\www and should work for upper and lower case I tried this:
2
1764
by: Mike Andrews | last post by:
Guys, I've got a regular expression that will just not work. I can't get it work properly and I would like to see if someone out there can tell me if I'm doing this wrong, or if there is a problem with the regex C library for linux. Here's my regular expression: ...
4
3215
by: Neri | last post by:
Some document processing program I write has to deal with documents that have headers and footers that are unnecessary for the main processing part. Therefore, I'm using a regular expression to go over each document, find out if it contains a header and/or a footer and extract only the main content part. The headers and the footers have no...
3
2283
by: Joe | last post by:
Hi, I have been using a regular expression that I don’t uite understand to filter the valid email address. My regular expression is as follows: <asp:RegularExpressionValidator id="valValidEmail" runat="server" ControlToValidate="txtEmail" ValidationExpression="^(+)(\.+)*@(+)(\.+)*(\.{2,4})$"
18
3022
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How ??
3
1338
by: Lucky | last post by:
hi guys, i'm practising regular expression. i've got one string and i want it to split in groups. i was trying to make one regular expression but i didn't successed. please help me guys. i'm using .NET 2.0's Regular expression class. here is the string.
17
2775
by: Mark | last post by:
I must create a routine that finds tokens in small, arbitrary VB code snippets. For example, it might have to find all occurrences of {Formula} I was thinking that using regular expressions might be a neat way to solve this, but I am new to them. Can anyone give me a hint here? The catch is, it must only find tokens that are not quoted...
6
2224
by: deepak_kamath_n | last post by:
Hello, I am relatively new to the world of regex and require some help in forming a regular expression to achieve the following: I have an input stream similar to: Slot: slot1 Description: this is a description Slot: slot2
14
2254
by: Chris | last post by:
I need a pattern that matches a string that has the same number of '(' as ')': findall( compile('...'), '42^((2x+2)sin(x)) + (log(2)/log(5))' ) = Can anybody help me out? Thanks for any help!
0
6178
by: altavim | last post by:
Usually when you make regular expression to extract text you are starting from simple expression. When you got to know target text, you are extending your expression. Subsequently very hard to ready long set of special symbols and impossible to improve such expression. We have to create ’smart’ regular expression. Instead of write one line...
0
7845
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7869
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6517
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5340
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3779
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3797
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2287
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.