Match A Symbol

Based on: Regular Expressions Cookbook

Preliminaries

# Load regex package
import re

Create some text

# Create a variable containing a text string
text = '$100'

Apply regex

# Find all instances of the exact match '$'
re.findall(r'\$', text)
['$']