Add tests. Fix bug in regex.