Has*_*tax 4 python regex string python-re
我想删除从+到 的所有内容@,包括+,但不删除@
我所能得到的最接近的是在正则表达式之间使用它。
>>> email = "garry+filter@gmail.com"
>>> re.sub(r'\+[^)]*\@', '', email)
garrygmail.com
Run Code Online (Sandbox Code Playgroud)
放入@替换字符串,而不是空字符串。
re.sub(r'\+[^)]*@', '@', email)
Run Code Online (Sandbox Code Playgroud)
顺便说一句,没有必要逃跑@。
| 归档时间: |
|
| 查看次数: |
1277 次 |
| 最近记录: |