Various regular expressions for validating phone, email, post code, national insurance number etc.

These are all in C# hence then @ in front of the string, (This prevents processing of escape sequences and having to escape with \\ all the time)

// UK Post Code
“^([A-PR-UWYZ0-9][A-HK-Y0-9][

AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$”;// UK Mobile Telephone Number
@”^(\+44\s?7\d{3}|\(?07\d{3}\)?)\s?\d{3}\s?\d{3}$”;

// UK Phone number
@”^\+?(\d|\s){6,}$”;

//Email Address
@”^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}” + @”\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\” + @”.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$”;

// Web URL
@”^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$”;

// UK Bank Number
@”^\d{8,8}$”;

// UK Bank SortCode
@”^\d{6,6}$|^\d{2,2}\-\d{2,2}\-\d{2,2}$”;

// Password
@”^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$”;

// Surname
@”^([a-zA-Z ‘-]+)$”;

//Alphabetical

@”[A-Za-z]”;