如何在 notepad++ 中删除电子邮件中“@”域之前包含少于 3 个字母的行

如何在 notepad++ 中删除电子邮件中“@”域之前包含少于 3 个字母的行

你好,我该如何删除电子邮件中@domain 之前包含少于 3 个字母的行,因为@domains 已经包含超过 3 个字母或 3 个字母,我想跳过它并在@domain 之前搜索

因此其为 s1111g@domain。“anything”:密码行

因此搜索将在“@”域名之前进行,例如@gmail 或@yahoo 或任何电子邮件

文件的完整示例包含:

[email protected]:Keepline1
[email protected]:Removeline0
S*556&[email protected]:Removeline0
*[email protected]:Keepline1
3%6%768()[email protected]:Removeline0
¿H£1§¥[email protected]:Removeline0
[email protected]:Keepline1
§[email protected]:Keepline1

需要结果:

[email protected]:Keepline1
*[email protected]:Keepline1
[email protected]:Keepline1
§[email protected]:Keepline1

答案1

以下是一种方法:

  • Ctrl+H
  • 找什么:^(?:[^a-z@]*[a-z]){0,3}[^a-z@]*@.+(?:\R|$)
  • 用。。。来代替:EMPTY
  • Replace all

解释:

^           : begining of line
(?:         : start non capture group
  [^a-z@]*  : 0 or more non alphabetic or @
  [a-z]     : an alphabetic
){0,3}      : group exists from 0 up to 3 times
[^a-z@]*    : 0 or more non alphabetic or @
@           : literally @
.+          : 1 or more any character but newline
(?:\R|$)    : any kind of linebreak (\r, \n, \r\n) or end of line

请勿检查. matches newline

给定示例的结果:

[email protected]:Keepline1
*[email protected]:Keepline1
[email protected]:Keepline1
§[email protected]:Keepline1

相关内容