shorthand character class represents \ any numeric digit from to \ any character that is not numeric digit from to \ any letternumeric digitor the underscore character (think of this as matching "wordcharacters \ any character that is not letternumeric digitor the underscore character \ any spacetabor newline character (think of this as matching "spacecharacters \ any character that is not spacetabor newline character classes are nice for shortening regular expressions the character class [ - will match only the numbers to this is much shorter than typing ( | | | | | note that while \ matches digits and \ matches digitslettersand the underscorethere is no shorthand character class that matches only letters (though you can use the [ -za-zcharacter classas explained next for exampleenter the following into the interactive shellxmasregex re compile( '\ +\ \ +'xmasregex findall(' drummers pipers lords ladies maids swans geese rings birds hens doves partridge'[' drummers'' pipers'' lords'' ladies'' maids'' swans'' geese'' rings'' birds'' hens'' doves'' partridge'the regular expression \ +\ \wwill match text that has one or more numeric digits (\ +)followed by whitespace character (\ )followed by one or more letter/digit/underscore characters (\ +the findall(method returns all matching strings of the regex pattern in list making your own character classes there are times when you want to match set of characters but the shorthand character classes (\ \ \sand so onare too broad you can define your own character class using square brackets for examplethe character class [aeiouaeiouwill match any vowelboth lowercase and uppercase enter the following into the interactive shellvowelregex re compile( '[aeiouaeiou]'vowelregex findall('robocop eats baby food baby food '[' '' '' '' '' '' '' '' '' '' '' 'pattern matching with regular expressions