How to remove all tags in XML file to display only desired text
What command would I use to remove all tags to display only what I want shown. There are hundreds of entries, only want to display the --name-- tag. Here is an example of a single entry.
Original Line
<game id="149526">
<path>./1943mii.zip</path>
<name>1943: The Battle of Midway Mark II</name>
<desc>1943: The Battle of Midway Mark II is an unofficial US version of the 1943 kai.</desc>
<image>./images/1943mii-image.png</image>
<video>./videos/1943mii-video.mp4</video>
<marquee>./images/1943mii-marquee.png</marquee>
<thumbnail>./images/1943mii-thumb.png</thumbnail>
<rating>0.5</rating>
<releasedate>19870101T000000</releasedate>
<developer>Capcom</developer>
<publisher>Capcom</publisher>
<genre>Shoot'em up / Vertical</genre>
<arcadesystemname>capcom</arcadesystemname>
<players>1-2</players>
<md5>5152b779738392fe2d6471b8c11a8b10</md5>
<lang>en</lang>
<region>us</region>
</game>
Line Needed
1943: The Battle of Midway Mark II
- Ctrl+H
- Find what:
<game.+?<name>(.+?)</name>.+?</game>
- Replace with:
$1
- CHECK Match case
- CHECK Wrap around
- CHECK Regular expression
-
CHECK
. matches newline
- Replace all
Explanation:
<game # open tag
.+? # 1 or more any character, not greedy
<name> # tag
(.+?) # group 1, 1 or more any character, not greedy
</name> # close tag
.+? # 1 or more any character, not greedy
</game> # close tag
Replacement:
$1 # content of group 1 (i.e. the name)
Screenshot (before):
Screenshot (after):