Fix issue #168 and some other cleanup

Fixes issue #168 in DeterministicTokenizer with an improved sgml regex that doesn't stack overflow on very long strings. Also made all parenthesized expressions non-capturing, and a couple other misc cleanups.