简体   繁体   English

在记事本++中如何查找与2“:”匹配的行

[英]In Notepad++ how to find lines matching 2 “:”

I'd like to search/find lines containing "@" then 2 times ":" 我想搜索/查找包含“ @”的行,然后搜索2次“:”

A few examples : 一些例子:

www@xxx:yyy:zzz would match (it contains "@" then ":" then ":" again)
sample:help:new would not match (no "@")
fun@blue:turtle would not match (only 1 time ":")

Many thanks! 非常感谢!

If you want to print the lines which has atleast one @ ,two : symbols then you could try the below regex. 如果要打印至少有一个@ ,two :符号的行,则可以尝试以下正则表达式。

^.*@.*:.*:.*$

If you want to print the lines which has exactly one @ symbol and two or more : symbols then you could try the below. 如果要打印正好有一个@符号和两个或多个:符号的行,则可以尝试以下操作。

^[^@]*@[^@]*:[^@]*:[^@]*$

DEMO 演示

这也将起作用:

.*?@.*?:.*?:.*

In the given example , 在给定的示例中,

www@xxx:yyy:zzz would match 
sample:help:new would not match 
fun@blue:turtle would not match


To match www@xxx:yyy:zzz would match alone , use the following 要匹配www@xxx:yyy:zzz would match单独www@xxx:yyy:zzz would match ,请使用以下命令

Answer: ((@.*){1})((:.*){2}) 答案: ((@.*){1})((:.*){2})

Explanation: 说明:

((@.*){1}) --> To match single @

((:.*){2}) --> To match two :

Note: Used Notepad++ 6.6.3 for testing the above regex 注意:使用Notepad ++ 6.6.3来测试上述正则表达式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM