This regex implementation is backwards-compatible with the standard
're' module, but offers additional functionality.