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.
<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.