有谁知道如何在 Notepad++ 的搜索框中搜索这样的内容?
ID。213
债务:13 美元
我希望这样搜索:
“ID。(不关心数字/任何字符),换行符,债务(不关心数字/任何字符)”
在 Find 中打开正则表达式模式,. matches newline
启用“”:
搜索:
ID\.\s.*[\n]+Debt:\s.*$
旧版本的 Notepad++ 难以匹配多行正则表达式,请确保拥有 6+ 版本的 Notepad++ 才能正常工作。
怎么样:
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
----------------------------------------------------------------------