Please find patch attached.
Some notes about the patch:
- TRT, I think, would be to change the whole cacheing to use Lisp objects etc. I couldn't persuade myself to do that.
- A less right thing, but better than the patch, would be to protect the cache entry in re_match_2_internal. But that requires interface changes because re_match_2_internal currently doesn't know about cash entries. I couldn't bring myself to do that either.
Another note: Should some document mention that trailing whitespace are not allowed in the git repo? I couldn't find that anywhere.