Having this test XML snippet, how to achieve selecting DTD between <!
and >
boundaries in JavaScript?
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
<!ENTITY % xinclude SYSTEM "http://www.oasis-open.org/docbook/xml/4.4/xinclude.mod">
<!ELEMENT xi:include (xi:fallback)?>
<!ATTLIST xi:include xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude">
<!ENTITY rsqb "]">
]>
<book>]></book>
Using <!(DOCTYPE[\S\s]*\])>
works unless ]>
combination appears later in document. I've tried negative lookahead, but failed to combine everything to get desired outcome.