Q:

delete 1 line before X til Y with regex

using Notepad++ find and replace in files, I need to delete 1 line before X, and delete until Y.
so in this sample i would need to delete starting from 1 line above
<string name="type" value="n"/>

to
</imgdir>

here is a sample of what im working with
    <imgdir name="48">
    <string name="type" value="m"/>
    <string name="id" value="1210100"/>
    <int name="x" value="1609"/>
    <int name="y" value="-407"/>
    <int name="mobTime" value="0"/>
    <int name="f" value="0"/>
    <int name="hide" value="0"/>
    <int name="fh" value="145"/>
    <int name="cy" value="-355"/>
    <int name="rx0" value="1286"/>
    <int name="rx1" value="1774"/>
</imgdir>
<imgdir name="49">
    <string name="type" value="m"/>
    <string name="id" value="1210100"/>
    <int name="x" value="1586"/>
    <int name="y" value="-390"/>
    <int name="mobTime" value="0"/>
    <int name="f" value="0"/>
    <int name="hide" value="0"/>
    <int name="fh" value="145"/>
    <int name="cy" value="-355"/>
    <int name="rx0" value="1286"/>
    <int name="rx1" value="1774"/>
</imgdir>
<imgdir name="19">
    <string name="type" value="n"/>
    <string name="id" value="1012110"/>
    <int name="x" value="-95"/>
    <int name="y" value="167"/>
    <int name="mobTime" value="0"/>
    <int name="f" value="0"/>
    <int name="hide" value="0"/>
    <int name="fh" value="47"/>
    <int name="cy" value="185"/>
    <int name="rx0" value="-145"/>
    <int name="rx1" value="-45"/>
</imgdir>
<imgdir name="50">
    <string name="type" value="n"/>
    <string name="id" value="1012119"/>
    <int name="x" value="-499"/>
    <int name="y" value="148"/>
    <int name="mobTime" value="0"/>
    <int name="f" value="0"/>
    <int name="hide" value="0"/>
    <int name="fh" value="199"/>
    <int name="cy" value="155"/>
    <int name="rx0" value="-549"/>
    <int name="rx1" value="-449"/>
</imgdir>

A:

I did it using this regex:
<imgdir.*\s+<string name="type" value="n"\/>\s+(.+\s+)+?<\/imgdir>

You can just replace this find with an empty string.
Try it on regex101

