Friday, 25 March 2016

XML : notepad++ xml node regex find and replace

can you tell me the what to search for in notepad++ in order to find all nodes with the optioncode 09 below and delete that node? For example, I would like to be able to search on the below xml and delete the first entry and be left with is below that.

I tried to searching for <Vehicle>.*?</Vehicle> which works to replace a blank value, however I want to also add criteria to search for the 09 value in the entire node. Is it possible to add a search condition for the ">09<" text string value?

Search here:

    <Vehicle>      <InvoiceDateTime>2016-03-20T00:00:00</InvoiceDateTime>      <InvoiceChargeCents>63</InvoiceChargeCents>      <OptionCode>09</OptionCode>      <JobEndDateTime>2016-03-19T00:00:00</JobEndDateTime>      <AuthorizationCode />    </Vehicle>    <Vehicle>      <InvoiceDateTime>2016-03-20T00:00:00</InvoiceDateTime>      <InvoiceChargeCents>63</InvoiceChargeCents>      <OptionCode>35</OptionCode>      <JobEndDateTime>2016-03-19T00:00:00</JobEndDateTime>      <AuthorizationCode />    </Vehicle>    

Return the entry below:

    <Vehicle>      <InvoiceDateTime>2016-03-20T00:00:00</InvoiceDateTime>      <InvoiceChargeCents>63</InvoiceChargeCents>      <OptionCode>35</OptionCode>      <JobEndDateTime>2016-03-19T00:00:00</JobEndDateTime>      <AuthorizationCode />    </Vehicle>    

No comments:

Post a Comment