Regular expressions (regex or regexp) are powerful tools used for pattern matching and searching within text

Source:

Regex Cheatsheet

CharacterMeaningExample
*Match zero, one, or more of the previousAh* matches "Ahhhhh" or "A"
?Match zero or one of the previousAh? matches "A1" or "Ah"
+Match one or more of the previousAh+ matches "Ah" or "Ahhh" but not "A"
\Used to escape a special characterHungry\? matches "Hungry?"
.Wildcard character, matches any characterdo.* matches "dog", "door", "dot", etc.
()Group charactersSee example for ``
[]Matches a range of characters[cbf]ar matches "car", "bar", or "far"
[0-9]+ matches any positive integer
[a-zA-Z] matches ASCII letters a-z and A-Z
[^0-9] matches any character not 0-9
``Matches previous OR next character/group`(Mon)(Tues)daymatches“Monday”or“Tuesday”`
{}Matches a specified number of occurrences of the previous[0-9]{3} matches "315" but not "31"
[0-9]{2,4} matches "12", "123", and "1234"
[0-9]{2,} matches "12345..."
^Matches the beginning of a string or negation in a range^http matches strings starting with "http", such as a URL
[^0-9] matches any character not 0-9
$Matches the end of a stringing$ matches "exciting" but not "ingenious"