reverse.go
func (r *Regexp) Revert(values url.Values) (string, error) {
	vars := make([]interface{}, len(r.groups))
	for k, v := range r.groups {
		if len(values[v]) == 0 {
			return "", fmt.Errorf(
				"Missing key %q to revert the regexp "+
					"(expected a total of %d variables)", v, len(r.groups))
		}
		vars[k] = values[v][0]
		values[v] = values[v][1:]
	}
	return fmt.Sprintf(r.template, vars...), nil
}
func (r *Regexp) Revert(values url.Values) (string, error) {
	vars := make([]interface{}, len(r.groups))
	for k, v := range r.groups {
		if len(values[v]) == 0 {
			return "", fmt.Errorf(
				"Missing key %q to revert the regexp "+
					"(expected a total of %d variables)", v, len(r.groups))
		}
		vars[k] = values[v][0]
		values[v] = values[v][1:]
	}
	return fmt.Sprintf(r.template, vars...), nil
}
func ( r * Regexp ) Revert ( values url . Values ) ( string , error ) { vars := make ( [ ] interface { } , len ( r . groups ) ) for k , v := range r . groups { if len ( values [ v ] ) == 0 { return " " , fmt . Errorf ( " " + " " , v , len ( r . groups ) ) } vars [ k ] = values [ v ] [ 0 ] values [ v ] = values [ v ] [ 1 : ] } return fmt . Sprintf ( r . template , vars ... ) , nil }
// Revert builds a string for this regexp using the given values. Positional
// values use an empty string as key.
//
// The values are modified in place, and only the unused ones are left.
Revert builds a string for this regexp using the given values . Positional values use an empty string as key . The values are modified in place and only the unused ones are left .