Skip to content

Instantly share code, notes, and snippets.

@SGA-A
Last active February 2, 2024 12:35
Show Gist options
  • Save SGA-A/a3bee054290d75783392644b9695a4ac to your computer and use it in GitHub Desktop.
Save SGA-A/a3bee054290d75783392644b9695a4ac to your computer and use it in GitHub Desktop.
Fundamental-SCs
. - 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 - Not a Whitespace (space, tab, newline)
\b - Word Boundary (it is a word)
\B - Not a Word Boundary (it is part of a word)
^ - Beginning of a String
$ - End of a String
[] - Matches Characters in brackets
[^ ] - Matches Characters NOT in brackets
| - Either Or
( ) - Group
Quantifiers:
* - 0 or More
+ - 1 or More
? - 0 or One (the preceding character is optional, but not consecutive)
{3} - Exact Number
{3,4} - Range of numbers (Minimum, Maximum)
MetaCharacters (Need to be escaped):
. ^ $ * + ? { } [ ] \ | ( )
Additional Special Characters:
\: - Matches a literal colon (needs to be escaped)*
\; - Matches a literal semicolon (needs to be escaped)*
\- - Matches a literal hyphen (needs to be escaped)*
\( - Matches a literal opening parenthesis (needs to be escaped)*
\) - Matches a literal closing parenthesis (needs to be escaped)*
*Remember that when you want to match these characters literally, you need to escape them using a backslash (\).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment