Validate SSN

Posted by Bubbly under Regular Expressions category on | Views : 5021
The following sampel code can be used for validating Social Security Number (SSN)

using System.Text.RegularExpressions;

public class SsnTextBox: RegExTextBox
public SsnTextBox()
this.ValidationExpression = @"^\d{3}-\d{2}-\d{4}$";
this.ErrorMessage = "The social security number must be in the form of 555-55-5555";

Comments or Responses

Login to post response