Title: Match Any Of A Series Of Options
Slug: match_any_of_series_of_characters
Summary: Match Any Of A Series Of Options
Date: 2016-05-01 12:00
Category: Regex
Tags: Basics
Authors: Chris Albon
Based on: Regular Expressions Cookbook
In [1]:
# Load regex package
import re
In [2]:
# Create a variable containing a text string
text = 'The quick brown fox jumped over the lazy brown bear.'
In [3]:
# Find any of fox, snake, or bear
re.findall(r'fox|snake|bear', text)
Out[3]: