Unify regex subcapture group processing