Regular Expression Validation - Range of numbers

  • Thread starter Thread starter WDC Online
  • Start date Start date
W

WDC Online

Guest
I am trying to update some old code that was created by a person quite a few years ago.

I am trying to validate a range from G 07 000000 to G 11 000000 (or G07000000 to G11000000).

The code was:

<asp:RegularExpressionValidator ID="RegularExpressionValidator_Card"

runat="server" ControlToValidate="tbBarcode" Display="Dynamic"

ErrorMessage="Sorry, but you do not appear to be authorised to view these references."

ValidationExpression="(G|g)0(7|8)\d{6}"></asp:RegularExpressionValidator>

and I changed it to:

<asp:RegularExpressionValidator ID="RegularExpressionValidator_Card"

runat="server" ControlToValidate="tbBarcode" Display="Dynamic"

ErrorMessage="Sorry, but you do not appear to be authorised to view these references."

ValidationExpression="(G|g)(07|08|09|10|11)\d{6}"></asp:RegularExpressionValidator>

It validated a range between G07000000 and G09999999 but when I try G10000000, it won't validate.

I am not a developer so am unsure what the "ValidationExpression" should be.

Any help appreciated :)

Continue reading...
 
Back
Top