re.match() tests a regular expression at the beginning of a string. It returns a re.Match object when the pattern matches and None otherwise; unlike re.search(), it does not begin searching later in the text. section 14.1.2 section 14.1.3
Split a word at its first vowel
>>> pattern = f'([{consonants}]+)?([aeiou])(.*)' >>> re.match(pattern, 'chair').groups() ('ch', 'a', 'ir') >>> re.match(pattern, 'apple').groups() (None, 'a', 'pple') >>> type(re.match(pattern, 'rdnzl')) <class 'NoneType'> Parentheses create capture groups, ? makes the leading consonants optional, and re.IGNORECASE handles uppercase input. section 14.1.3 section 14.1.3
>>> text = 'chair' >>> re.match(pattern, text) #1 <re.Match object; span=(0, 1), match='c'> #2
Inspect a successful beginning-of-string match on “chair.” section 14.1.2

