improved re templates

in re template mode, substitution is done while parsing the template, without the
intermediate conversion to str.format() template

this allows detection of references to unmatched groups, which raises an exception in re
(corresponding tests have been re-enabled in test_pcre.py)

re template parser now detects malformed "\g<name>" references and raises an error
(corresponding tests have been re-enabled in test_pcre.py)

in str.format() mode, references to unmatched groups are replaced with "" instead of "None"