Improve regex, fixes #1