473,387 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

explainable RegEx behavior?

OK, so I am was never so good on NFAs and DFAs, but I am just trying
to get one of the Microsoft-supplied RegEx samples to work. It is the
last example (describing the Capture class) from this page:

http://msdn.microsoft.com/library/de...ionclasses.asp

Basically, it returns no Groups as coded. If I change the RegEx to
"(abc)+", it works like I would expect (since this says one or more
groups rather than zero or more groups).

I would think that "zero or more" of this construct would also work.

I got my (real oproject) code to work, but I am probably going to run
into some problem in the future, that will have the same answer as
this weird case, so..

Thanks in advance.

Regards..
Nov 20 '05 #1
1 834
Did I get you right? You want to match something like "(abc)*"?
This should match just about anything, as any character location can be read
as "0 repetitions of (abc)"
You should have some must-be-there-string in front of or after a 0-or-more
expression, like "(abc)*def"

There's an excellent book on the topic "Mastering regular expressions".
Really worth the price!

Niki

"Relishguy" <re*******@pluggedin.org> wrote in
news:1e**************************@posting.google.c om...
OK, so I am was never so good on NFAs and DFAs, but I am just trying
to get one of the Microsoft-supplied RegEx samples to work. It is the
last example (describing the Capture class) from this page:

http://msdn.microsoft.com/library/de...ionclasses.asp
Basically, it returns no Groups as coded. If I change the RegEx to
"(abc)+", it works like I would expect (since this says one or more
groups rather than zero or more groups).

I would think that "zero or more" of this construct would also work.

I got my (real oproject) code to work, but I am probably going to run
into some problem in the future, that will have the same answer as
this weird case, so..

Thanks in advance.

Regards..

Nov 20 '05 #2

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

Similar topics

7
by: alphatan | last post by:
Is there relative source or document for this purpose? I've searched the index of "Mastering Regular Expression", but cannot get the useful information for C. Thanks in advanced. -- Learning...
8
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
by: Daniel Billingsley | last post by:
First, if MSFT is listening I'll say IMO the MSDN material is sorely lacking in this area... it's just a whole bunch of information thrown at you and you're left to yourself as to organizing it in...
1
by: Relishguy | last post by:
OK, so I am was never so good on NFAs and DFAs, but I am just trying to get one of the Microsoft-supplied RegEx samples to work. It is the last example (describing the Capture class) from this...
6
by: Chris Anderson | last post by:
Anyone know of a fix (ideally) or an easy workaround to the problem of escape characters not working in regex replacement text? They just come out as literal text For example, you'd think that thi...
5
by: Chris | last post by:
How Do I use the following auto-generated code from The Regulator? '------------------------------------------------------------------------------ ' <autogenerated> ' This code was generated...
1
by: rh | last post by:
hi all, take the following 2 c# lines: 1) str = Regex.Replace(str, ".*AAA", ""); 2) str = Regex.Replace(str, "^.*AAA", ""); notice that the only difference is that the pattern in line 2 has a...
4
by: Henrik Dahl | last post by:
Hello! In my application I have a need for using a regular expression now and then. Often the same regular expression must be used multiple times. For performance reasons I use the...
3
by: Rob | last post by:
Hi, I've written a small VB application that parses an HTML document and removes code I don't need and re-writes the file. I'm looking for the regex pattern that will remove the following code: ...
4
by: Danny Ni | last post by:
Hi, The following code snippet is causing CPU to max out on my local machine and production servers. It looks fine on Expresso though. Regex rgxVideo = new...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...

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.