"Character class" or "character set" &it is a set of characters enclosed in square brackets. The regular expression engine matches only one of several characters in a character class or character set. We put the characters we want to match in square brackets. If you want to match any vowel, we use the [aeiou] character set.
A class or character set matches only one character. The order of characters within a character class or set does not matter. The results are identical.
We use a hyphen inside a character class to indicate a range of characters. [0-9] matches one digit from 0 to 9. Similarly, for uppercase and lowercase letters, we have the [A-Za-z] character class
The following code finds and prints everything vowels on this line
import re s = ’mother of all ba ttles’ result = re.findall (r’ [aeiou] ’, s) print result
This gives the output
[’o’,’ e’, ’o’,’ a’, ’a’,’ e’]