v Match Any Of A List Of Characters - Regex

Match Any Of A List Of Characters

Based on: Regular Expressions Cookbook

Preliminaries

# Load regex package
import re

Create some text

# Create a variable containing a text string
text = 'The quick brown fox jumped over the lazy brown bear.'

Apply regex

# Find all instances of any vowel
re.findall(r'[aeiou]', text)
['e', 'u', 'i', 'o', 'o', 'u', 'e', 'o', 'e', 'e', 'a', 'o', 'e', 'a']