revert regex "cleanup" that seems unjustified and may break backtracking

it's not clear to me at the moment whether the code that was removed
(and which is now being re-added) is needed, but it's far from being a
no-op, and i don't want to risk breaking regex in this release.
release notes for 0.9.9