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

  1. Write a regular expression to match SSNs as per the following rules:

  1. Assume SSNs do not start with a 0

  1. SSNs can start or end a line or, both

  1. SSNs can be followed or preceded by a whitespace

  1. SSNs can be followed or preceded by the punctuation symbol set: { , . ; : ? ! }

  1. 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
  2. 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!