regcomp.c: Consolidate duplicated code into 1 place