Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Python

r"
\"Tarzan\"|(Tarzan)
"
g

Description

For example, when it is needed to match the string "Tarzan" (without the quotes), in "Tarzan and Jane", and "Jane and Tarzan", but not in "Tarzan" (with the quotes). The <i>wanted</i> string is in Group 1.

Submitted by anonymous - 7 years ago