pandas Regular expressions


Example

# Extract strings with a specific regex
df= df['col_name'].str.extract[r'[Aa-Zz]']

# Replace strings within a regex
df['col_name'].str.replace('Replace this', 'With this')

For information on how to match strings using regex, see Getting started with Regular Expressions.