Validate phone liberally


/ Published in: C#
Save to your folder(s)

A very liberal validation of phone number. Assures there are at least 10 digits in there somewhere.


Copy this code and paste it in your HTML
  1. protected void ValidPhone(object source, ServerValidateEventArgs e)
  2. {
  3. MatchCollection m = Regex.Matches(e.Value, "[0-9]");
  4. e.IsValid = (m.Count > 9);
  5. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.