Fix the regex shim Haskell code.
Fix the regex shim Haskell code.

The old replacement code was pretty thoroughly broken.  I validated
this version with a selection of manual tests.  This would
definitely be a reasonable place to include some unit testing,
though.

See #137

alphalambda/codeworld,alphalambda/codeworld,pranjaltale16/codeworld,alphalambda/codeworld,google/codeworld,google/codeworld,pranjaltale16/codeworld,google/codeworld,pranjaltale16/codeworld