Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Case-Insensitive RegularExpressionValidator

Status
Not open for further replies.

melimae

ISP
Jul 29, 2005
16
US
I am trying to use a regularexpressionvalidator to verify that a valid state abbreviation was entered. I want it to be case insensitive. Below is my control, but it is not working correctly. I get a syntax error.

<asp:RegularExpressionValidator ControlToValidate="txtBankState" ID="valStateLen" runat="server" ErrorMessage="Please enter a valid state." ValidationExpression="(?i:A[LKSZRAEP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])" text="*"/>

I have also tried
ValidationExpression="(?i)(A[LKSZRAEP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])"

and ValidationExpression="(A[LKSZRAEP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])"

The last one works, but only for capital letters.

I have also tried using style="text-transform:uppercase" on my text box control but the regularexpressionvalidator does not work when I use it.

Any help is greatly appreciated.
 
Sorry, I posted this on the wrong forum. I thought I was in ASP.NET.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top