Skip to content

Instantly share code, notes, and snippets.

@AWaselnuk
Created February 5, 2015 18:15
Show Gist options
  • Save AWaselnuk/196efed2481e1c603cea to your computer and use it in GitHub Desktop.
Save AWaselnuk/196efed2481e1c603cea to your computer and use it in GitHub Desktop.
Regex cheatsheet as JS comments
// 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