regular expressions cheatsheet

Regular Expressions Matching Table metacharacter matching things \d \D matching all the digits(0 to 9), matching any non-digit character .(dot) matching any single character(letter, digit, whitespace, everything) [] matching a single letter inside [](square brackets) [^] matching any single character except for the letters inside [](square brackets) with the ^(hat) [-] [^-] indicating a character range to match a single character \w \W this is equivalent to the character range [A-Za-z0-9_], matching any non-alphanumeric character {} to match repetition of character * + to match either 0 or more or 1 or more of the character that it follows(it always follows a character or group) ? this metacharacter allows to match either 0 or 1 of the preceding character or group \s \S to match all whitespaces, matching any non-whitespace character ␣ to match space \t to match tab \n to match new line \r to match carriage return(useful in Windows environments) ^ $ the start and the end of the line, it’s only used at the beginning or end of a line () match groups (()) nested groups (|) to denote different possible sets of characters \b to match the boundary between a word and a non-word character Details \d the 123s ...