Support POSIX regex matching.

Fixes #561