4 ms·
Strings that look like text or markup may or may not be, depending on whether they are surrounded by comments, CDATA marked sections, or processing instructions
by prodigal_erik 17y ago
Strings that look like text or markup may or may not be, depending on whether they are surrounded by comments, CDATA marked sections, or processing instructions. Most people who try this get it wrong, and end up with a tool that randomly fails on some documents. Getting it right requires a regex big enough to actually be an XML parser, and why write that from scratch rather than use one that's known to work (and understand well-formedness and namespaces as well)?