Title: Match Any Of A List Of Characters
Slug: match_any_of_a_list_of_symbols
Summary: Match Any Of A List Of Characters
Date: 2016-05-01 12:00
Category: Regex
Tags: Basics
Authors: Chris Albon

Based on: Regular Expressions Cookbook

Preliminaries


In [2]:
# Load regex package
import re

Create some text


In [3]:
# Create a variable containing a text string
text = 'The quick brown fox jumped over the lazy brown bear.'

Apply regex


In [5]:
# Find all instances of any vowel
re.findall(r'[aeiou]', text)


Out[5]:
['e', 'u', 'i', 'o', 'o', 'u', 'e', 'o', 'e', 'e', 'a', 'o', 'e', 'a']