Use static Regex methods instead of creating new Regex instances

Fixes #42