RegEx Count 
Author Message
 RegEx Count

How can I check to see if at least n characters are in the string but they
can appear anywhere?

A#2ksdfaAfa0 should return true because at least 2 CAPS are in there...

I don't care where they occur, as long as there are at least 2 of them...

Regex.IsMatch(text, "^([A-Z]?*){2}&")

Thanks,

Shawn



Tue, 13 Sep 2005 08:03:49 GMT  
 RegEx Count
Regex.IsMatch(text, "([A-Y].*){2}")

--
Stephen Weatherford, VB .NET Team
This posting is provided "AS IS" with no warranties, and confers no rights.
| A#2ksdfaAfa0 should return true because at least 2 CAPS are in there...
|
| I don't care where they occur, as long as there are at least 2 of them...
|
|
|
| Regex.IsMatch(text, "^([A-Z]?*){2}&")



Wed, 14 Sep 2005 05:24:37 GMT  
 RegEx Count
OMG... that's awesome... I thought I tried everything including that... and
I did except I had the ^ in the front and that's why it failed.  You know,
I'll get the hang of this yet...

BTW: www.planet-source-code.com search for "shawn bullock" in the .net or VB
section... you'll see my validator class.  in my new version I'll have this
weekend I'll credit everyone for helping me on the particular RegEx's that
they helped me in.

Thanks,
Shawn



Quote:
> Regex.IsMatch(text, "([A-Y].*){2}")

> --
> Stephen Weatherford, VB .NET Team
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> | A#2ksdfaAfa0 should return true because at least 2 CAPS are in there...
> |
> | I don't care where they occur, as long as there are at least 2 of
them...
> |
> |
> |
> | Regex.IsMatch(text, "^([A-Z]?*){2}&")



Wed, 14 Sep 2005 06:22:11 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. A Different Count between ListParagraphs.Count and the sum of Lists(index).ListParagraphs.Count

2. ListView Column Count / Subitem Count?

3. RegEx - sorry to bother - found the solution

4. RegEx - my personal illogical nightmare

5. Using Regex to get a block of text

6. RegEx Capturing

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

8. Help with Regex.Replace pls...

9. More RegEx III

10. More RegEx (Numbers with Commas)

11. RegEx

12. RegEx US State Abbr. Validation Prob

 

 
Powered by phpBB® Forum Software