有没有人知道如何在Notepad ++的搜索框中搜索这样的内容?
ID。 213
债务:13 $
我希望这样搜索:
“身份证明。(不管数字/任何角色),换行,债务(不管数字/任何角色)”
答案 0 :(得分:5)
启用“. matches newline
”,启用“查找”中的正则表达式模式:
搜索:
ID\.\s.*[\n]+Debt:\s.*$
较旧版本的Notepad ++难以匹配多行正则表达式,请务必使用版本6+ Notepad ++来实现此目的。
答案 1 :(得分:1)
怎么样:
ID\..*?Debt:
不要忘记启用. matches newline
<强>解释强>
(?^:ID\..*?Debt:)
The regular expression:
(?-imsx:ID\..*?Debt:)
matches as follows:
NODE EXPLANATION
----------------------------------------------------------------------
(?-imsx: group, but do not capture (case-sensitive)
(with ^ and $ matching normally) (with . not
matching \n) (matching whitespace and #
normally):
----------------------------------------------------------------------
ID 'ID'
----------------------------------------------------------------------
\. '.'
----------------------------------------------------------------------
.*? any character including \n (0 or more times
(matching the least amount possible))
----------------------------------------------------------------------
Debt: 'Debt:'
----------------------------------------------------------------------
) end of grouping
----------------------------------------------------------------------