好的,例如我得到了以下 3 行:
2536320:GlorySon:[email protected]:84.153.217.22:a6b585f1ba0461ae2ae30cca72c5d9e0:J3!'Zau&@s`IlB%\\gDhqk>K8~W,QSP
470957:Redemptor:[email protected]:24.77.161.226:daa4f847e4c2eef69d3fd30bab8c8ae2:]2a
49114:Lavis:[email protected]:82.236.195.211:8db988462a0c5403a4c2afc2c4e5f87d:/<I
我想将它们转换为:
[email protected]
[email protected]
[email protected]
有人能帮我用正则表达式来得到我想要的结果吗:))
答案1
下面将提取所有电子邮件地址,这似乎是您的要求
\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b
您可以在此处测试https://regex101.com/r/jrncm1/1
答案2
- Ctrl+H
- 找什么:
^.+?:([^:@]+@[^:]+).*$
- 用。。。来代替:
$1
- 检查环绕
- 检查正则表达式
- 取消选中
. matches newline
- Replace all
解释:
^ # beginning of line
.+? # 1 or more any character, not greedy
: # a colon
( # start group 1
[^:@]+ # 1 or more any character that is not : or @
@ # @ sign
[^:]+ # 1 or more any character that is not :
) # end group
.* # 0 or more any charactre but newline
$ # end of line
给定示例的结果:
[email protected]
[email protected]
[email protected]
屏幕截图: