func getNextWildcard(pattern string) (wildcard, _ string) {
	pos := wildcardPattern.FindStringIndex(pattern)
	if pos == nil {
		return "", pattern
	}
	wildcard = pattern[pos[0]:pos[1]]

	// Reach last character or no regexp is given.
	if len(pattern) == pos[1] {
		return wildcard, strings.Replace(pattern, wildcard, `(.+)`, 1)
	} else if pattern[pos[1]] != '(' {
		switch {
		case isSpecialRegexp(pattern, ":int", pos):
			pattern = strings.Replace(pattern, ":int", "([0-9]+)", 1)
		case isSpecialRegexp(pattern, ":string", pos):
			pattern = strings.Replace(pattern, ":string", "([\\w]+)", 1)
		default:
			return wildcard, strings.Replace(pattern, wildcard, `(.+)`, 1)
		}
	}

	// Cut out placeholder directly.
	return wildcard, pattern[:pos[0]] + pattern[pos[1]:]
}
func getNextWildcard(pattern string) (wildcard, _ string) {
	pos := wildcardPattern.FindStringIndex(pattern)
	if pos == nil {
		return "", pattern
	}
	wildcard = pattern[pos[0]:pos[1]]

	
	if len(pattern) == pos[1] {
		return wildcard, strings.Replace(pattern, wildcard, `(.+)`, 1)
	} else if pattern[pos[1]] != '(' {
		switch {
		case isSpecialRegexp(pattern, ":int", pos):
			pattern = strings.Replace(pattern, ":int", "([0-9]+)", 1)
		case isSpecialRegexp(pattern, ":string", pos):
			pattern = strings.Replace(pattern, ":string", "([\\w]+)", 1)
		default:
			return wildcard, strings.Replace(pattern, wildcard, `(.+)`, 1)
		}
	}

	
	return wildcard, pattern[:pos[0]] + pattern[pos[1]:]
}
func getNextWildcard ( pattern string ) ( wildcard , _ string ) { pos := wildcardPattern . FindStringIndex ( pattern ) if pos == nil { return " " , pattern } wildcard = pattern [ pos [ 0 ] : pos [ 1 ] ] // Reach last character or no regexp is given. if len ( pattern ) == pos [ 1 ] { return wildcard , strings . Replace ( pattern , wildcard , `(.+)` , 1 ) } else if pattern [ pos [ 1 ] ] != '(' { switch { case isSpecialRegexp ( pattern , " " , pos ) : pattern = strings . Replace ( pattern , " " , " " , 1 ) case isSpecialRegexp ( pattern , " " , pos ) : pattern = strings . Replace ( pattern , " " , " \\ " , 1 ) default : return wildcard , strings . Replace ( pattern , wildcard , `(.+)` , 1 ) } } // Cut out placeholder directly. return wildcard , pattern [ : pos [ 0 ] ] + pattern [ pos [ 1 ] : ] }
// getNextWildcard tries to find next wildcard and update pattern with corresponding regexp.
getNextWildcard tries to find next wildcard and update pattern with corresponding regexp .