Created
August 12, 2016 15:06
-
-
Save thilak-rao/50f0da8dc4eaccf2ed6b000c6960b165 to your computer and use it in GitHub Desktop.
Frequently Used Regular Expressions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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