HamZaの助けを借りて、私はこれを思いつきました:
交換:
(S#.*?;) (?=.*?</ns)
と:
\1
Replace All次に、置換が行われなくなるまでヒットします (各検索には が含まれるS#
ため、一度にこれらの文字列のそれぞれに対して 1 つの置換しか実行できません)。または、単純なマクロを作成して、検索して置換 (すべて?) し、実行することができます。必要な回数だけ。
この文字列が独自の行にある場合は、行の開始 ( ^
) と終了 ( $
) インジケータも含める必要があります。
^(S#.*?;) (?=.*?</ns$)
説明: ( source )
NODE EXPLANATION
--------------------------------------------------------------------------------
( group and capture to \1:
--------------------------------------------------------------------------------
S# 'S#'
--------------------------------------------------------------------------------
.*? any character except \n (0 or more times
(matching the least amount possible))
--------------------------------------------------------------------------------
; ';'
--------------------------------------------------------------------------------
) end of \1
--------------------------------------------------------------------------------
' '
--------------------------------------------------------------------------------
(?= look ahead to see if there is:
--------------------------------------------------------------------------------
.*? any character except \n (0 or more times
(matching the least amount possible))
--------------------------------------------------------------------------------
</ns '</ns'
--------------------------------------------------------------------------------
) end of look-ahead
Notepad++ が可変長の後読みをサポートしている場合 (少なくとも 6.4.5 ではサポートされていません)、 を に置き換えることができまし(?<=S#14.*?); (?=.*?</ns)
た;
(そして 1 つ実行しただけReplace Allです)。