refactor path pattern parser