试图让简单的正则表达式在 XML 文件上工作

Trying to get v. simple Regex to work on XML file

这是我的 XML 片段(实际完整文件是 6964 行):

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchema Location="http://www.gstatic.com/localfeed/local_feed.xsd">
<language>en</language>
<id>43927</id>
<cell1>Andover House</cell1>
<cell2>28-30 Camperdown</cell2>
<cell3>Great Yarmouth</cell3>
<cell4>NR30 3JB</cell4>
<cell5>GB</cell5>
<cell6>52.6003767</cell6>
<cell7>1.7339649</cell7>
<cell8>+44 1493843490</cell8>
<category>British</cell9>
<cell10>http://contentadmin.livebookings.com/dynamaster/image_archive/original/f24c60a52e7ac0874be57e51bce30726.jpg</cell10>
<cell11>http://www.bookatable.co.uk/andover-house-great-yarmouth-norfolk</cell11>

对于上述代码段中的每个类别标签,我只想添加以下文本:Restaurant -(连字符后有一个空格)

因此最终结果将是:

<category>Restaurants - British</category>

我是 Regex 的新手,发现它非常困难,所以这是我迄今为止尝试过的方法:https://regex101.com/r/yY5jB6/2

它看起来像是在 Regex 101 中工作,但是当我使用 [=27 将它带入 Sublime 2(在 Mac 上)和 Notepad ++(在 Windows 上)等文本编辑器时=](在设置中指定正则表达式),它说找不到任何东西。请帮忙!谢谢!

如果您搜索

<category>([^<]*)<\/.*>

并将其替换为

<category>Restaurants - </category>

它甚至可以处理包含 </item9> 标签的奇怪输入。

NotePad++ 使用 </code> 而不是 <code>,如果您将替换从 Restaurants -Restaurants - 那么它应该可以工作。 (来自 this question