Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / December 2004

Tip: Looking for answers? Try searching our database.

regex: Nested quantifier ?. error! help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mad Scientist Jr - 29 Dec 2004 16:30 GMT
I am trying to use regex to find a string where ? could be between 0
and 10 characters, for instance the strings:

Error. Username 1092006871 does not exist. Record not processed.
Error. Username abc123 does not exist. Record not processed.
Error. Username does not exist. Record not processed.

would all yield results

However, the regex I am using:

Username ?????????? does not exist.

Gives a "Nested quantifier ?." error.

I have tried using *:

Username * does not exist.

but it doesn't find anything.

The only thing that seems to work is .:

Username .......... does not exist.

But that only matches on cases where the username is exactly 10
characters. I would like to match on cases where the username is
between 0 and 10.

Any help (and especially examples) appreciated.
Niki Estner - 30 Dec 2004 12:50 GMT
>I am trying to use regex to find a string where ? could be between 0
> and 10 characters, for instance the strings:
[quoted text clipped - 26 lines]
>
> Any help (and especially examples) appreciated.

In a nutshell: ? and * don't behave the way you think they do.

Here's a nice tutorial about regular expressions:
http://www.codeproject.com/useritems/RegexTutorial.asp

Instead of writing ....... 10 times, you can use .{10}; You can also use
.{0,10} for a variable number of characters (in this case 0-10).
However, this would match 0-10 characters, whatever these characters are
(blanks, special characters, digits...), I'm not sure if that's what you
want...

Niki
Mad Scientist Jr - 30 Dec 2004 17:46 GMT
.{0,10}
was exactly what I was looking for
thanks for the reply !

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.