Skip to content

Instantly share code, notes, and snippets.

@while0pass
Created October 15, 2010 10:26
Show Gist options
  • Save while0pass/627970 to your computer and use it in GitHub Desktop.
Save while0pass/627970 to your computer and use it in GitHub Desktop.
regexps
email address
^\w*([A-Z0-9._%-]+@([A-Z0-9\-]\.)+[A-Z]{2,6})\w*$
options: case insensitive
При сохранении имейла надо сохранять только группу схваченную в скобках.
По бокам допускаются пробельное пространство.
password with at least 8 characters
containing at least one digit or punctuation mark, one upper case and one lower case letter
^(?=.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*
(?![.\n]) means that the pattern doesn't match password if it contains dot or new line char
in the very beginning. Does it really matter?
options: multiline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment