regcomp.c: Actually emit proper warning

Before this commit, /\g/ raised the wrong warning
    Reference to invalid group 0
This rearranges the code so that the proper warning is emitted.
    Unterminated \g... pattern