regex: rewrite the repetition parsing code

The goto logic was hard to follow and modify. This is
in preparation for the BRE \+ and \? support.
1 file changed