June 2000
Intermediate to advanced
556 pages
8h 45m
English
It is possible to write a single regular expression that will tokenize XML into markup and data components. Robert D. Cameron has developed such a regular expression and presented it in the Markup Languages journal.[3]
[3] “REX: XML shallow parsing with regular expressions,” Markup Languages: Theory & Practice 1.3 (1999).
The article included a Perl 5 implementation that was used by David Niergarth (jdnier@execpc.com) to produce a Python implementation. A sample REX application is shown below. It works by importing the XML-SPE regular expression from the REX module. This expression is then used with the findall function provided by the re module. Given a string and a regular expression, ...
Read now
Unlock full access