Last active
February 10, 2020 20:19
-
-
Save fjcaetano/5600452 to your computer and use it in GitHub Desktop.
Some patterns to use with NSStringMask
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These are a few patterns commonly used. | |
1 - Digits only: (\\d+) | |
2 - Names without special characters: ([A-Za-z\\s]+) | |
3 - Email: (([\\w\\.\\-]*?@)([\\w\\.\\-]+)(\\.[a-z]{2,4}) # Incompatible with versions previous to 1.1.2 of NSStringMask | |
4 - Dates: (\\d{2})/(\\d{2})/(\\d{4}) | |
5 - SSN: (\\d{3})-(\\d{2})-(\\d{3}) | |
6 - Telephone: (\\d{3})-(\\d{3})-(\\d{4}) | |
Brasil: | |
1 - CPF: (\\d{3}).(\\d{3}).(\\d{3})-(\\d{2}) | |
2 - RG: (\\d{2}).(\\d{3}).(\\d{3})-(\\d|x|X) | |
3 - CEP: (\\d{2}).(\\d{3})-(\\d{3}) | |
4 - Telefone: (\\d{2}) (\\d{4})-(\\d{4}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
any solution for the multiple digits phone?
i can't use
shouldChangeCharactersInRange
cause i have a list of all countries around the world, and a regex for each country, so, i don't know which one has more digits.this is my list, but the regex are all fakes, i haven't created any regex yet