Skip to content

Instantly share code, notes, and snippets.

@codepotato
Created October 11, 2019 09:24
Show Gist options
  • Save codepotato/882659ca7ff4614284dd844b7051aeba to your computer and use it in GitHub Desktop.
Save codepotato/882659ca7ff4614284dd844b7051aeba to your computer and use it in GitHub Desktop.
UK Telephone Number Regex
/^(((\+44\s?\d{4}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((\+44\s?\d{3}|\(?0\d{3}\)?)\s?\d{3}\s?\d{4})|((\+44\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$/
@codepotato
Copy link
Author

If used in VeeValidate you can do something like this:

v-validate="{required: true, regex: /^(((\+44\s?\d{4}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((\+44\s?\d{3}|\(?0\d{3}\)?)\s?\d{3}\s?\d{4})|((\+44\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$/}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment