【发布时间】:2021-08-05 09:16:12
【问题描述】:
我需要替换电子邮件字符串中的一些字符,正是这样的操作:
lower_email = str.lower(str.split(email,'@')[0])
nopunc_email = re.sub('[!@#$%^&*()-=+.,]', ' ', lower_email)
nonum_email = re.sub(r'[0-9]+', '', nopunc_email).strip()
但在 SQL 中
我尝试使用表达式TRANSLATE(lower(email), 'a1_a.a-a@1-+()a ', 'a a a a'),但它没有给我解决方案。
提前致谢!
例如:
import re
email = 'some_email.example-2021@gmail.com'
lower_email = str.lower(str.split(email,'@')[0])
nopunc_email = re.sub('[!@_#$%^&*()-=+.,]', ' ', lower_email)
nonum_email = re.sub(r'[0-9]+', '', nopunc_email).strip()
result 'some email example'
【问题讨论】:
-
Привет!你能不能至少给我们一个期望的结果?
-
样本数据和预期结果会有很大帮助,但
replace(translate(email,'!#$%^&*()=+','?'),'?')怎么样? -
在描述中提供了所需的结果)
标签: sql regex oracle python-re