Skip to content

Instantly share code, notes, and snippets.

@thilak-rao
Created August 12, 2016 15:06
Show Gist options
  • Select an option

  • Save thilak-rao/50f0da8dc4eaccf2ed6b000c6960b165 to your computer and use it in GitHub Desktop.

Select an option

Save thilak-rao/50f0da8dc4eaccf2ed6b000c6960b165 to your computer and use it in GitHub Desktop.
Frequently Used Regular Expressions
// Matching a alpha numeric username/password that is 3 to 16 charecters long
`/^[a-z0-9_-]{3,16}$/`
// Matching a hex value that begins with a hash, between 6 and 3 char long
`/^#?([a-f0-9]{6}|[a-f0-9]{3})$/`
// Regular expression that matches a email address
`/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/`
// Regular expression that matches a URL
`/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment