[英]Bookmark multiple line regex result in notepad++
I have a Logfile where I need to extract several lines in a new File.我有一个日志文件,我需要在新文件中提取几行。 I can mark these Lines with the following Regex Query.* message.*\r\n.*ApplicationGatewayID = 5009.*\r\n.*\r\n.*\r\n
When I activate the Bookmark Line it only bookmarks the first line.我可以使用以下 Regex Query.* message.*\r\n.*ApplicationGatewayID = 5009.*\r\n.*\r\n.*\r\n
当我激活书签行时,它只为第一行添加书签。
To extract multiline blocks of text with your regex, you may use Replace dialog with:要使用您的正则表达式提取多行文本块,您可以使用替换对话框:
Find What : (.*Query.* message.*\R.*ApplicationGatewayID = 5009.*\R.*\R.*\R)|^(?..*Query.* message)?*\R?
查找内容: (.*Query.* message.*\R.*ApplicationGatewayID = 5009.*\R.*\R.*\R)|^(?..*Query.* message)?*\R?
Replace With : $1
替换为: $1
The regex is of the form: (<YOUR_REGEX_MATCHING_LINES>)|^(?..*<STARTING_PART_OF_REGEX>)?*\R?
正则表达式的形式为: (<YOUR_REGEX_MATCHING_LINES>)|^(?..*<STARTING_PART_OF_REGEX>)?*\R?
. .
Details细节
(.*Query.* message.*\R.*ApplicationGatewayID = 5009.*\R.*\R.*\R)
- a line with Query
and then message
words on it, then the next line that has ApplicationGatewayID = 5009
on it and then 2 more lines, captured into Group 1 ( $1
refers to this value) (.*Query.* message.*\R.*ApplicationGatewayID = 5009.*\R.*\R.*\R)
- 一行带有Query
和message
字,然后是ApplicationGatewayID = 5009
的下一行在它上面,然后是另外 2 行,捕获到第 1 组( $1
指的是这个值)|
- or - 或者^(?..*Query.* message)?*\R?
- start of a line ( ^
) that has no Query
and then message
on it, then the whole line and optional linebreak after it are matched and eventually removed. - 没有Query
的行 ( ^
) 的开头,然后是message
,然后匹配并最终删除整行和可选的换行符。See the Notepad++ test:请参阅 Notepad++ 测试:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.