Skip to content

Instantly share code, notes, and snippets.

@craigerskine
Last active December 2, 2016 21:09
Show Gist options
  • Save craigerskine/04efc3d0a2af018501ec to your computer and use it in GitHub Desktop.
Save craigerskine/04efc3d0a2af018501ec to your computer and use it in GitHub Desktop.
Simple email REGEX

^(/|http://|https://)
Start with / or http

^(http|https):\/\/((?!domain.com).)*$
This is for redirecting to EXTERNAL websites ONLY!!! Do not use this to redirect to pages or files within your own site. This field must start with http(s):// and NOT contain domain.com

^[\s\S]{0,200}$
MAX = 200 characters

^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$
Email

^[^&'"]*$
Do not allow &, ', or "

^[0-9\.]*$
Allow only #'s or .

(^[0-9\.]*$)
Allow only #'s, ., or empty

^[a-zA-Z0-9|\s|,]*$
Alphanumeric characters ONLY

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