正規表示式

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

有關如何使用正規表示式匹配字串的資訊,請參閱正規表示式入門 。