在Emacs中是否有一种简单的方法来搜索和替换XML文件中的文本,但是对于s& r操作来说只对文档文本起作用,而不是标记?
例如:
...
There is some text above here
[mark-starts-here]
<some_tag key="value">
text
</some_tag>
[mark-ends-here]
There is some text below here
...
将e
替换为E
以获取:
...
There is some text above here
[mark-starts-here]
<some_tag key="value">
tExt
</some_tag>
[mark-ends-here]
There is some text below here
...
答案 0 :(得分:1)
我不知道xml模式是否具有类似内置的功能,但这是一个简单的功能:
(defun my-replace-outside-of-tags (regexp replacement)
(while (re-search-forward regexp nil t)
(unless (save-match-data
(looking-at "[^<>]*>"))
(replace-match replacement))))