Regular expression for validating a number
That’s why most websites asking for a Social Security number provide three different input fields, in order to eliminate the variations.
Regular expressions should not be used in place of good form design.
Let's suppose that you want your JSF field to allow only Numeric values - all you need to do is add to it the ADF Faces provided regular expression validator and then provide the right regex format.
For Example: Now run your page and try entering characters to the field and leaving it.
Next, remove all punctuation and spaces from the remainder so that you're left with the 7, 9 or 10 digit National Significant Number. Social Security Numbers This blog post focuses on validating the last of those: Social Security Numbers and why they may be a bit deceivingly more difficult to validate than you might expect.I’ll provide a few different methods to handle the actual validation through Regular Expressions and let you determine which one might best suit your needs.Since there’s only one dash between the sequences of digits, it can be given without any special character.However, if there’s a possibility the string will have a Social Security number without the dashes, you’d want to change the regular expression pattern to:) is used to indicate that the line terminates at the end of the Social Security number.