1

I'm using the following validation for fax numbers:

[RegularExpression(@"^\+[0-9]{1,3}\([0-9]{3}\)[0-9]{7}$", ErrorMessage = "This is not a valid fax number.")]

But the fax number form entry does not accept any input.

Simon Adcock
  • 3,484
  • 3
  • 24
  • 41

2 Answers2

2

Try this;

\+[0-9]{1,3}\([0-9]{3}\)[0-9]{7}

Sample outputs;

+895(194)6165163
+09(155)2541778

You don't need to use ^ for this. It means "except".

Soner Gönül
  • 94,086
  • 102
  • 195
  • 339
0
^[01]?[- .]?\(?[2-9]\d{2}\)?[- .]?\d{3}[- .]?\d{4}$

Try this........

Chetan Sanghani
  • 2,078
  • 2
  • 21
  • 34