好的,例如我得到了這 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]
螢幕截圖: