简体   繁体   English

Notepad ++中的单行正则表达式搜索

[英]Single line regex search in Notepad++

When I use "Find Next" to find the next match for a regex in Notepad++ (v. 7.8.6), the match can span several lines.当我使用“查找下一个”在 Notepad++(7.8.6 版)中查找正则表达式的下一个匹配项时,匹配项可以跨越多行。 Is there a way to limit the matches to a single line, ie to search each line separately?有没有办法将匹配限制在一行,即分别搜索每一行?

There is no option in Notepad++ to disable matching across multiple lines. Notepad++ 中没有选项可以禁用多行匹配。

The match texts in the Find results window are truncated , that does not mean that Notepad++ can be "set" to search within single lines.查找结果window 中的匹配文本被截断,这并不意味着 Notepad++ 可以“设置”在单行内搜索。

The " . matches newline " option only affects the . . newline ”选项只影响. behavior: if the option is OFF, .行为:如果选项为 OFF . does not match line break chars by default.默认情况下不匹配换行符。

However, \s ( any whitespace chars ), \W ( any non-word chars ), [^57] ( any char but 5 and 7 ) patterns still may "overflow" from line to line because line break chars are among those characters those patterns match.但是, \s任何空白字符)、 \W任何非单词字符)、 [^57]57之外的任何字符)模式仍然可能从一行“溢出”,因为换行符在这些字符中这些模式匹配。

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

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