Created
February 5, 2015 18:15
-
-
Save AWaselnuk/196efed2481e1c603cea to your computer and use it in GitHub Desktop.
Regex cheatsheet as JS comments
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
// From: http://regexone.com/ | |
// | |
// abc… Letters | |
// 123… Digits | |
// \d any Digit | |
// . any Character | |
// \. Period | |
// [abc] Only a, b, or c | |
// [^abc] Not a, b, nor c | |
// [a-z] Characters a to z | |
// [0-9] Numbers 0 to 9 | |
// {m} m Repetitions | |
// {m,n} m to n Repetitions | |
// * Zero or more repetitions | |
// + One or more repetitions | |
// ? Optional | |
// \s any Whitespace | |
// ^…$ Starts and ends | |
// () capture Group | |
// (a(bc)) capture Sub group | |
// (.*) capture Variable content | |
// (a|b) Matchs a or b | |
// \w any Alphanumeric character | |
// \W any Non-alphanumeric character | |
// \d any Digit | |
// \D any Non-digit character | |
// \s any Whitespace | |
// \S any Non-whitespace character |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment