Fix typo in regular expression

Correctly close end brace. Improve performance slightly in
artificially generated worst case.