Skip to content

Instantly share code, notes, and snippets.

@alvinncx
Created April 6, 2019 07:54
Show Gist options
  • Save alvinncx/5469241599e37cf2dbd3a1b3eab4e421 to your computer and use it in GitHub Desktop.
Save alvinncx/5469241599e37cf2dbd3a1b3eab4e421 to your computer and use it in GitHub Desktop.
Username and email regex
@mail_regex ~r/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/
@username_regex ~r/^(?=.{8,20}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._]+(?<![_.])$/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment