Posted By

housecor on 09/08/10


Tagged

regex phone validation


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


Validate phone liberally


 / Published in: C#
 

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

  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  

You need to login to post a comment.