Regular Expressions

andrewp777

New member
Joined
Apr 5, 2008
Messages
1
Programming Experience
1-3
Hello,

I am trying to use the vb.net/asp.net RegularExpressionValidator control but I am having some problems

I am trying to set the validationexpression property to this
re.ValidationExpression = "[A-Z]+"

... to match at least 1 Capital letter anywhere in the string and zero or more numbers, lowercase letters or uppercase letters before and after the capital letter(s).
It only seems to match this pattern when the string begins with one or more capital letters

i.e. DF is matched but 73rDF isnt.

I have changed the validationexpression property to this
're.ValidationExpression = ".*[A-Z]+.*"

... to match what I want to achieve but I am pretty sure when reading websites that all I have to set the property to [A-Z]+ to match at least 1 Capital letter anywhere in the string

How would I match at least two numbers in a string, I can only write an expression that matches two number together i.e. ".*[0-9]{2,}.*"

Hope someone can help

Thanks
Andrew
 
Back
Top