Title: Match A Unicode Character
Slug: match_a_unicode_character
Summary: Match A Unicode Character
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 = 'Microsoft™.'

Apply regex


In [3]:
# Find any unicode character for a trademark
re.findall(r'\u2122', text)


Out[3]:
['™']