How to check textbox with regex?

I checked my regular expression in "rubular" and passed all of my prerequisites. But when I use this in the asp text box, it is not passed true.

My code looks below

<asp:TextBox ID="MobileNumber" runat="server"></asp:TextBox> <asp:RegularExpressionValidator ID="MobileNumberValidater" runat="server" ControlToValidate="MobileNumber" ErrorMessage="Please enter valid Numbers"></asp:RegularExpressionValidator> 

My regex looks below

^ ((0 (\ = \ d * \ d * #) [\ d] {, 11}) (# \ d {, 5})?) | (0 (?: \ D {, 10}) (# \ d {, 5})?) | (0 ((? = \ D * \ d * $) [\ d] {, 11}))) $

I am trying to check the following lines:

1) .012345 6789 # 123

2) .025698 785 # 6548

Thanks.

0
source share
1 answer

A quick check here shows that the regular expression you are using is incorrectly formatted for the .Net client. I am not familiar with Rubular, but it may happen that it uses a different regex mechanism.

I had a game with your regular expression, but these phone numbers didn’t look the way I saw, so if you’re stuck it might be worth a look.

+1
source

All Articles