Created
January 9, 2023 00:46
-
-
Save ahmedrowaihi/4b5b0907dc7ae067d7122b434980771a to your computer and use it in GitHub Desktop.
A regex of saudi number pattern
This file contains 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
/** A regex of saudi number pattern | |
* numbers will be accepted must match following formats: | |
* 9665xxxxxxxx, 009665xxxxxxxx, 05xxxxxxxx, +9665xxxxxxxx | |
* ^(\+966|966|00966|0)5 means that the number can start with +9665 or 9665 or 009665 or 05 | |
* \d{8}$, means there should be 8 digits, and $ means the end of the string. | |
* All together: ^(\+966|966|00966|0)5\d{8}$ | |
*/ | |
const SaudiNumRegExp = /^(\+966|966|00966|0)5\d{8}$/; | |
export default SaudiNumRegExp; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment