Search code examples
xmlfindwildcardtext-editorzipcode

Find specific value in between XML element


I'm trying to edit an XML file to remove all +4 in zipcodes. There are 90,000 records to go through.


This is what the field/element looks like:
<postal-code>08556-0086</postal-code>


This is what we want it to look like:
<postal-code>08556</postal-code>


Can I do a find and replace in a text editor ? If yes, how would I search for this in the file? If no, what is the best way to go about editing the zipcodes.


Solution

  • In notepad++ you can replace using regular expression: Ctrl+F -> Replace -> Search mode: "Regular expression"

    The following strings are working for me:

    Find what: -[0-9]+</postal-code>

    Replace with: </postal-code>