[英]REGEX in notepad++ to only show lines containing certain text?
I have a huge text file that has so much unneeded text and I want to just filter out the bits of text that interest me. 我有一个很大的文本文件,其中包含很多不需要的文本,我只想过滤掉我感兴趣的文本。 The format for what I want is in the example below: 我想要的格式是在下面的示例中:
{\"animal\":\"crocodile\",\"class\":\"reptilia\"}
There are hundreds of different animals and of course classes. 有数百种不同的动物,当然还有课程。
How can I use regex in notepad++ to show only these lines of text in the whole document? 如何在notepad ++中使用正则表达式在整个文档中仅显示这些文本行?
EDIT after last comment, you can try 在最后评论后编辑,您可以尝试
Find what 找什么
(\\"(animal|class)\\":\\".*?\\")?\K.*?(?=\\"(animal|class)\\":)
Replace with 用。。。来代替
\n
.
matches newline 匹配换行符 Replace all 全部替换
EDIT added double backslash \\\\
to match \\
in the document. EDIT在文档中添加了双反斜杠\\\\
以匹配\\
。
following regex 以下正则表达式
\\"(animal|class)\\"\s*:
will match any of animal
or class
between "
followed by 0 or more spaces followed by :
将匹配"
后跟0或多个空格,然后跟的任何animal
或class
:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.