删除 SGML 中的多个标签
我有一个 sgml 文件,就像
<p><p><data>sdlksdskdmskdmsamdakmdksam<p></data>...
我的问题是如何删除一个标签
并保持另一个完整......哪个正则表达式是可以的......
i have a sgml file like
<p><p><data>sdlksdskdmskdmsamdakmdksam<p></data>...
my question is how to remove one tag <p>
and keep another one intact ...which regular expression would be siutable......
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的 SGML 可以作为 XML 进行处理,那么 XProc 是一个很好的技术类似的事情,只需一个步骤,例如:(
假设您想要删除所有自嵌套的 p 元素,直到 p 永远不会自行包装)。
您绝对不想想要使用正则表达式处理 SGML/XML,除非您 100% 确定您将处理具有某种明确指定的词汇形式的子集。例如,考虑一下如何使用正则表达式处理带有注释的内容:
!!
If your SGML is such it can be processed as XML, then XProc is a good technology for this kind of thing, with a single step such as:
(Assuming you want to remove all self-nested p elements until p never wraps itself).
You definitely do not want to process SGML/XML with regexps unless you are 100% certain you will be dealing with a subset which has a certain well-specified lexical form. Think for example how you'd process stuff with comments using a regexp:
!!