Replaced set of hard-coded strings with a regular expression.

The transformation is now applied to lines containing an arbitrary number of opening braces, followed by an arbitrary number of closing braces, followed by an optional semicolon, all interspersed with arbitrary whitespace.
This matches more lines while still keeping the spirit of this project. For example, it now matches an empty body ("{}") and the closing of multiple namespaces ("}}}").

I was afraid the regular expression would hurt performance, but after trying it out for a while I did not notice any substantial difference.