473,513 Members | 2,563 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RegEx Help!!

Can someone help me with expression needed to extract the entire string

FOO*1*DATA*DATA*ID~

1. This string pattern is embedded in a super long string..

TIA

This is my unsuccessful attempt
Regex re = new Regex("[F][O][O][*][0-9][*][~]");
MatchCollection m = re.Matches(content);
ArrayList al=new ArrayList();
foreach (Match m in m)
{
al.Add(m.Value);
}
Jan 10 '07 #1
2 1215
Vai2000 wrote:
Can someone help me with expression needed to extract the entire string

FOO*1*DATA*DATA*ID~
If you really want to just find FOO*1*DATA*DATA*ID~ in a longer
string, you can use @"FOO\*1\*DATA\*DATA\*ID~" as the Regex pattern.

Otoh, if you really want to just find the literal string,
String.IndexOf is going to be faster than a Regex.

--

..NET 2.0 for Delphi Programmers
www.midnightbeach.com/.net
Jan 10 '07 #2
Can someone help me with expression needed to extract the entire string
>
FOO*1*DATA*DATA*ID~

1. This string pattern is embedded in a super long string..

TIA

This is my unsuccessful attempt
Regex re = new Regex("[F][O][O][*][0-9][*][~]");
MatchCollection m = re.Matches(content);
ArrayList al=new ArrayList();
foreach (Match m in m)
{
al.Add(m.Value);
}
Your regex matches a string FOO*1*~ (where "1" could be any number from
0-9). It doesn't match the string you give in your example, because of
the "DATA*DATA*ID" part.

If the string you are after starts with "FOO*1*" (but any number
instead of the 1) and ends with "~", you could use:
FOO\*[0-9]\*[^~]*~

the "[^~]*" part matches any string not containing a ~
(note: instead of "[F][O][O]" you can simply use "FOO")

Hans Kesting
Jan 10 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1669
by: leegold2 | last post by:
I'm new to PHP regex. What I am trying to match is: http://library.dayton.town.net it's a mysql/php field. Then if a match I take some action. But it's not working any help appreciated....
8
5527
by: Bibe | last post by:
I've been trying to get this going for awhile now, and need help. I've done a regex object, and when I use IsMatch, it's behavior is quite weird. I am trying to use Regex to make sure that a...
2
1975
by: John Baro | last post by:
I need to determine when multiple fonts are selected in a richtextbox. A font is indicated by \fcharset(N) where (N) is a number. (To the best of my knowledge) I can use this statement int...
6
4775
by: Dave | last post by:
I'm struggling with something that should be fairly simple. I just don't know the regext syntax very well, unfortunately. I'd like to parse words out of what is basically a boolean search...
8
1671
by: rh0dium | last post by:
Hi all, I am using python to drive another tool using pexpect. The values which I get back I would like to automatically put into a list if there is more than one return value. They provide me...
2
2358
by: Alex Maghen | last post by:
This is a bit of an abuse of this group. Just a nit, but I'm hoping someone really good with Regular Expressions can help me out here. I need to write a regular expression that will do the...
4
1906
by: MooMaster | last post by:
I'm trying to develop a little script that does some string manipulation. I have some few hundred strings that currently look like this: cond(a,b,c) and I want them to look like this: ...
0
1614
by: Support Desk | last post by:
That’s it exactly..thx -----Original Message----- From: Reedick, Andrew Sent: Tuesday, June 03, 2008 9:26 AM To: Support Desk Subject: RE: regex help The regex will now skip anything with...
4
1107
by: Support Desk | last post by:
Anybody know of a good regex to parse html links from html code? The one I am currently using seems to be cutting off the last letter of some links, and returning links like http://somesite.co ...
2
1005
by: Support Desk | last post by:
I am working on a python webcrawler, that will extract all links from an html page, and add them to a queue, The problem I am having is building absolute links from relative links, as there are so...
0
7158
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...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7098
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...
1
5085
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...
0
4745
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...
0
1592
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 ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.