I am writing a REGEX for social secuirty number. I want to combine the two regex so that social security number can be accepted like so:
123456789
123-45-6789
After searching other post on the internet, I came up with something like so:
Regex regx = new Regex("^\\d{9}$");
Regex regx2 = new Regex("^\\d{3}-\\d{2}-\\d{4}$");
Can I combine them together so that if the user enters 12345678 or 123-45-6789. they both will be valid.
any help will be appreciated.