Anyname Donotcare
Anyname Donotcare

Reputation: 11423

How to validate exact 9 digits

I want to validate nine digit account number so i use the following validator :

   <asp:RegularExpressionValidator ID="RegularExpressionValidator12" runat="server" ControlToValidate="txt_manual" ErrorMessage="Wrong account number" ValidationExpression="^\\d{9}$" ValidationGroup="M1"></asp:RegularExpressionValidator>

Using : ^\\d{9}$

but i always get wrong account number even with the exact nine numbers like :

000067543
900765432
098675432

Upvotes: 0

Views: 1130

Answers (1)

Mathias-S
Mathias-S

Reputation: 805

You shouldn't escape \d:

^\d{9}$

Upvotes: 8

Related Questions