正则表达式

# 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')

有关如何使用正则表达式匹配字符串的信息,请参阅正则表达式入门 。