Skip to content

Instantly share code, notes, and snippets.

@Surf-logic
Last active February 9, 2023 12:34
Show Gist options
  • Save Surf-logic/2b755528575a643bc86e4e3bf48bd391 to your computer and use it in GitHub Desktop.
Save Surf-logic/2b755528575a643bc86e4e3bf48bd391 to your computer and use it in GitHub Desktop.
Regex cheat sheet
### Regex Cheet Sheet
. - any character except new line
\d - digit (0-9)
\D - Not a digit (0-9)
\w - word character (a-z, A-Z, 0-9, _)
\W - Not a word character
\s - whitespace (space, tab, newline)
\S - non whitespace (space, tab, newline)
\b - word boundary
\B - Not a word boundary
^ - begining of a string
$ - end of a string
[ ] - matches caracters in brackets
[^ ] - matches caracters in Not brackets
| - either or
( ) - group
Quantifiers:
* - 0 or more
+ - 1 or more
? - 0 or 1
{3} - exact number
{3,4} - range of numbers (minimum, maximum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment