parse_subpattern refactoring