code: func translateGlob(pat string) (string, error) {
  	if !globRe.MatchString(pat) {
  		return "", Error(pat)
  	}
  
  	outs := make([]string, len(pat))
  	i, double := 0, false
  	for _, c := range pat {
  		switch c {
  		default:
  			outs[i] = string(c)
  			double = false
  		case '.', '+', '-', '^', '$', '[', ']', '(', ')':
  			outs[i] = `\` + string(c)
  			double = false
  		case '?':
  			outs[i] = `[^/]`
  			double = false
  		case '*':
  			if double {
  				outs[i-1] = `.*`
  			} else {
  				outs[i] = `[^/]*`
  			}
  			double = !double
  		}
  		i++
  	}
  	outs = outs[0:i]
  
  	return "^" + strings.Join(outs, "") + "$", nil
  }
docs: // Supports unix/ruby-style glob patterns:
  //  - `?` matches a single char in a single path component
  //  - `*` matches zero or more chars in a single path component
  //  - `**` matches zero or more chars in zero or more components