import re s = 'aaa@xxx.com bbb@yyy.com ccc@zzz.com' print(re.sub('[a-z]*@', 'ABC@', s)) # ABC@xxx.com ABC@yyy.com ABC@zzz.com