SSN Validation using Edit Validate Rule
Hi,
I have a requirement to validate SSN, only when Citizenship is US.
Below is the code for OOTB, SSN edit validate rule.
String SSN = "^(\\d{3})-?\\d{2}-?\\d{4}$"; java.util.regex.Pattern p = java.util.regex.Pattern.compile(SSN); java.util.regex.Matcher m = p.matcher(theValue); String[] strArr = theValue.split("-"); int numDashes = strArr.length - 1; boolean isSSN = m.matches(); if((isSSN == false) || (numDashes == 0)){ return false; } if(theValue.length()!=11) { return false; } return true;
Please let me know how to modify the code according to my requirement.
Thanks.