Search code examples
regexnotepad++

Notepad++ find under a condition?


This is my sentence

「システム、スキャンモード。特定しました。

This sentence has a CRLF at the end. I wish to match the 。CRLF at the end, but ONLY if the string starts with . I thought it would not be too hard to do this but I couldn't do it. I tried multiple variations of

^(?=「).*。\R

This will go through the condition, but matches the whole line instead of just 。CRLF I am a regex newbie, so I think this is probably not hard at all. I am just not very knowledgeable about it.


Solution

  • You can match at the beginning of a line first and then use \K to discard the current matched text from the final match:

    ^「.*\K。\R