v Match Exact Text - Regex

Match Exact Text

Based on: Regular Expressions Cookbook


# 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 the exact match 'The'
re.findall(r'The', text)