Support for regexp on different platforms

Fixes #719