Validating social security number java
*/ public static boolean is Email Valid(String email)/** is Phone Number Valid: Validate phone number using Java reg ex.
* This method checks if the input string is a valid phone number. Phone number to validate * @return boolean: true if phone number is valid, false otherwise.
My Fields Validation class has following methods: Validate email address using Java regex /** is Email Valid: Validate email address using Java reg ex.
* This method checks if the input string is a valid email address. Email address to validate * @return boolean: true if email address is valid, false otherwise.
should match to anything in that format, assuming that it has to be a number.
UPDATE On June 25, 2011, the SSA changed the SSN assignment process to "SSN randomization". SSN randomization affects the SSN assignment process in the following ways: It eliminates the geographical significance of the first three digits of the SSN, previously referred to as the Area Number, by no longer allocating the Area Numbers for assignment to individuals in specific states.See the JDK Documentation on regex to learn more about using regular expressions in Java.Using this package I created a utility class to validate some commonly used data elements. (); //Valid SSNs ssns.add("1"); ssns.add("8"); //Invalid SSNs ssns.add("0"); ssns.add("6"); ssns.add("9"); ssns.add("85-345-6789"); ssns.add("856-453-6789"); ssns.add("81"); ssns.add("856-456789"); String regex = "^(?! Anyone out there know how to improve this function?
Feel free to modify and use this class in your projects.