More RegEx III 
Author Message
 More RegEx III

Greetings,

Thanks for everyone's help on my RegEx problems yesterday.  I posted an
early version of my Validator class on planet-source-code today in the .NET
section (search for "Shawn Bullock").  I have corrected the numerical
problems in that upload and will update the source as soon as I get home.

Until then, I have another question about RegEx... suppose I want to create
a RegEx that validations a logon name with some rules attached...must be at
least n characters long (I know how to do this) and must contain at least 2
numerics and 1 special characters and 1 capital letter... can a RegEx handle
this?

Thanks,
Shawn



Tue, 13 Sep 2005 03:33:22 GMT  
 More RegEx III
Hi Shawn,

sure this is possible!

This one should do the trick:
^(?=.*\d.*\d)(?=.*\W)(?=.*[A-Z]).{4,}$

(replace "4" by your "n")

BTW: RegexBuilder is a tool which helps developing and testing matching
regexps under .NET without any button clicking and other overhead:
http://sf.net/projects/regexbuilder/

Best Regards,

Markus Renschler

http://www.csunit.org/  -  Complete Solution testing (C#, VB.NET, Managed
C++)!


Quote:
> Greetings,

> Thanks for everyone's help on my RegEx problems yesterday.  I posted an
> early version of my Validator class on planet-source-code today in the
.NET
> section (search for "Shawn Bullock").  I have corrected the numerical
> problems in that upload and will update the source as soon as I get home.

> Until then, I have another question about RegEx... suppose I want to
create
> a RegEx that validations a logon name with some rules attached...must be
at
> least n characters long (I know how to do this) and must contain at least
2
> numerics and 1 special characters and 1 capital letter... can a RegEx
handle
> this?

> Thanks,
> Shawn



Tue, 13 Sep 2005 08:27:58 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. RegEx - sorry to bother - found the solution

2. RegEx - my personal illogical nightmare

3. Using Regex to get a block of text

4. RegEx Capturing

5. How to split URL without http:// using RegEx?

6. Help with Regex.Replace pls...

7. RegEx Count

8. More RegEx (Numbers with Commas)

9. RegEx

10. RegEx US State Abbr. Validation Prob

11. RegEx question

12. REGEX, groups and matching

 

 
Powered by phpBB® Forum Software