0

I've been poking around and trying to find the solution to this problem I have but I haven't had any luck. Sorry if this has been covered before.

I need to pull a string of text out of a variable line and replace it with different variables.

Currently it is:

<SimpleData name="HDRNAME">Uprr #43 Pan Am B #12</SimpleData>

I need it to look like:

<name>Uprr #43 Pan Am B #12</name>

This is a huge *.kml file generated by a back end inventory program that really isn't playing nice.

Thanks

djikay
  • 9,792
  • 8
  • 40
  • 50
jgrano
  • 1

1 Answers1

0

The simplest is to replace <(/)?[^>]+> with <$1>. Just select regular expression when you do it.

Try it: http://regex101.com/r/lP9iK0/1

Alternatively: Replace <[^>]+>([^<]+)</[^>]+> with <name>$1</name>.

Try it: http://regex101.com/r/lP9iK0/3

Note in regex101, the slash has to be escaped, but it doesn't in Notepad++.


Please consider bookmarking the Stack Overflow Regular Expressions FAQ for future reference.

Community
  • 1
  • 1
aliteralmind
  • 18,274
  • 16
  • 66
  • 102