...
Regex Code | Purpose | Valid Values | Invalid Values |
---|---|---|---|
^\(\d{3}\) \d{3}-\d{4}$ | To format phone numbers as (###) ###-#### | (888) 123-4567 | 8881234567 888-123-4567 888 123-4567 (888)1234567 (888)123-4567 |
^\d{3}-\d{3}-\d{4}$ | To format phone numbers as ###-###-#### | 888-123-4567 | 8881234567 888-123-4567 888 123-4567 (888) 1234567 (888) 123-4567 |
^[a-z.0-9_-]{3,30}@abc\.lmno\.edu$ | To format email addresses and make sure that:
You can use this and replace the abc, lmno, and edu with the valid email address for you clients | alliebrown89@abc.lmno.edu | allie!brown89@abc.lmno.edu alliebrown89@def.lmno.edu alliebrown89@abc.pqrs.edu alliebrown89@abc.lmno.com |
| To match all valid dates including leap years. Formats accepted mm/dd/yyyy or mm-dd-yyyy or mm.dd.yyyy format | 05/01/2023 05-01-2023 05.01.2023 | 05//01/2023 05-01--2023 05..01.23 |
^[a-zA-Z0-9]{12} | To match a 12-alpha-numeric character field for an ID or similar. Rejects symbols and spaces. (You can change the integer between the curly brackets {} for any whole number of characters.) | 1234asDfUi89 987jUh456ioP 1J2Ie4i0k2U4 | 1234 $Dfipasdfu12 87as78df56a0s |