How to delete values from xml in NOTEPAD++

notepadxml

I have a large xml that has the below structure:

            <subform name="PRE_EC02_S1A">
                <field name="RIGA07">R7</field>
                <field name="RIGA08">R8</field>
                <field name="IMPOR20">I20</field>
                <field name="IMPOR21">I21</field>
                <field name="IMPOR22">I22</field>
                <field name="IMPOR23">I23</field>
                <field name="IMPOR24">I24</field>
                <field name="IMPOR25">I25</field>
                <field name="IMPOR26">I26</field>
                <field name="IMPOR27">I27</field>
                <field name="IMPOR28">I28</field>
            </subform>

I need to delete all the values from all of the fields. I can do it manually but as the document is very large it will take a lot of time. I would like to know if there is a way to delete them automatically. For example: I need deleted all the values like R7, R8, I20, I21 and so on

Thank you very much in advance.

Best Answer

I have tested this with the sample you provided and it works in Notepad++. Open the replace dialog (Ctrl+H) and select at the bottom "Regular expressions". Then type the following: ([\>]).*([\<]) Replace with: \1\2

Edit: If you happen to have other xml tags with text inside you do not want to delete, if you want to empty only the field tags, then search for the following:

([\<]field name[\=\"].*[\"\>]).*([\<]\/field[\>])

Replace again with \1\2

Related Question