Faster drawing of red diagnostic underlines

The new version of the regex executes faster.

Fixes #968.