如何在 notepad++ 或 Emeditor 中删除所有不包含 email:password 的行

如何在 notepad++ 或 Emeditor 中删除所有不包含 email:password 的行

完整示例文件包含:

[email protected]:testing1
Yse@rur:userto
astr@[email protected]:str@st5es
@username1:password2
user2:@pass3
[email protected]:1password
my@example
[email protected]:password
!@#$%^
Star:userfor1
[email protected]:usepass1
\https]
[email protected]:testing@
Ge@rT@y:p@ssword
us@r!to$:!@troll
1800t0p@m@:1800t0p
[email protected]:super@1to
@st@rs:to!e@rth
[email protected]:euar@tres@
S@ur:info@tro
[email protected]:scroll2
F@st@tr@y:sla@ys#
[email protected]:stark6d8r@

需要保留结果:

[email protected]:testing1

astr@[email protected]:str@st5es


[email protected]:1password

[email protected]:password


[email protected]:usepass1

[email protected]:testing@

需要结果剪切:

Yse@rur:userto
@username1:password2
user2:@pass3
my@example
!@#$%^
Star:userfor1
\https]
Ge@rT@y:p@ssword
us@r!to$:!@troll
1800t0p@m@:1800t0p
@st@rs:to!e@rth
S@ur:info@tro
F@st@tr@y:sla@ys#

答案1

以下是一种方法:

根据修改后的问题进行编辑:(我猜你想在域名中加一个点)

  • Ctrl+H
  • 找什么:^(?!\S+@\S+?\.\S+?:)\S+\R
  • 用。。。来代替:EMPY
  • Replace all

解释:

^       : begining of line
(?!     : start negative lookahead, make sure we have NOT
  \S+   : 1 or more non space character
  @     : literally @
  \S+?  : 1 or more non space character, not greedy
  \.    : a dot
  \S+?  : 1 or more non space character, not greedy
  :     : literally :
)       : end lookahead
\S+     : 1 or more non space character
\R      : any kind of line break

给定示例的结果:

[email protected]:testing1
astr@[email protected]:str@st5es
[email protected]:1password
[email protected]:password
[email protected]:usepass1
[email protected]:testing@
[email protected]:super@1to
[email protected]:euar@tres@
[email protected]:scroll2
[email protected]:stark6d8r@

相关内容