Title: Match A Symbol
Slug: match_a_symbol
Summary: Match A Symbol
Date: 2016-05-01 12:00
Category: Regex
Tags: Basics
Authors: Chris Albon

Based on: Regular Expressions Cookbook

Preliminaries


In [1]:
# Load regex package
import re

Create some text


In [2]:
# Create a variable containing a text string
text = '$100'

Apply regex


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


Out[4]:
['$']