Question: Write a regular expression to match SSNs as per the following rules: Assume SSNs do not start with a 0 SSNs can start or end
- Write a regular expression to match SSNs as per the following rules:
- Assume SSNs do not start with a 0
- SSNs can start or end a line or, both
- SSNs can be followed or preceded by a whitespace
- SSNs can be followed or preceded by the punctuation symbol set: { , . ; : ? ! }
- Also, match SSNs of the form xx-xxx-9999 OR XX-XXX-9999, where only the last 4 digits are exposed. For simplicity, assume a string xX-XXXx-9999 will also match
- The symbol in the SSNs is optional.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
