Notepad++ use both regular expressions and extended search

风流意气都作罢 提交于 2019-11-29 12:41:35

You should instead use this regex:

\R(?!M)

Explanation:

  • \R Any Unicode newline sequence.
  • (?!M) Negative Lookahead: Assert "M" cannot be matched.

\r\n is valid with Regular expression checked in the Find tab too - i.e. not just with Extended checked: why not just use \r\n[^M] with Regular expression checked?

Given the following test text...

whatever
M
whatever
G
foo

..., \r\n[^M] yields the expected results below...

Search "\r\n[^M]" (3 hits in 1 file)
  new  2 (3 hits)
    Line 2: M
    Line 3: whatever
    Line 4: G

..., the matches being at the ends of the matched lines of course.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!