Improved the regular expressions.

Closes #59