revel/revel · validation.go
go logo
func (v *Validation) Match(str string, regex *regexp.Regexp) *ValidationResult {
	return v.apply(Match{regex}, str)
}
Similar code snippets
1.
webx-top/webx · validation.go
Match rating: 81.49% · See similar code snippets
go logo
func (v *Validation) Match(obj interface{}, regex *regexp.Regexp, key string) *ValidationResult {
	return v.apply(Match{regex, key}, obj)
}
2.
hyperledger/burrow · filter.go
Match rating: 64.14% · See similar code snippets
go logo
func match(regex *regexp.Regexp, text *string) bool {
	// Always match on a nil regex (indicating no constraint on text),
	// and otherwise never match on nil text (indicating a non-string convertible type)
	return regex == nil || (text != nil && regex.MatchString(*text))
}
3.
taskcluster/pulse-go · pulse.go
Match rating: 61.67% · See similar code snippets
go logo
func match(regex, text string) string {
	if matched, _ := regexp.MatchString(regex, text); matched {
		return regexp.MustCompile(regex).ReplaceAllString(text, "$1")
	}
	return ""
}
4.
choria-io/go-choria · util.go
Match rating: 59.21% · See similar code snippets
go logo
func MatchAnyRegex(str []byte, regex []string) bool {
	for _, reg := range regex {
		if matched, _ := regexp.Match(reg, str); matched {
			return true
		}
	}

	return false
}
5.
zebresel-com/mongodm · validation.go
Match rating: 58.22% · See similar code snippets
go logo
func validateRegexp(regex string, target string) bool {

	match, err := regexp.MatchString(regex, target)

	if err != nil {
		fmt.Println("%v", err)
	}

	return match
}
6.
siddontang/ledisdb · scan.go
Match rating: 57.75% · See similar code snippets
go logo
func buildMatchRegexp(match string) (*regexp.Regexp, error) {
	var err error
	var r *regexp.Regexp

	if len(match) > 0 {
		if r, err = regexp.Compile(match); err != nil {
			return nil, err
		}
	}

	return r, nil
}
7.
openshift/origin · regexp.go
Match rating: 55.95% · See similar code snippets
go logo
func expression(res ...*regexp.Regexp) *regexp.Regexp {
	var s string
	for _, re := range res {
		s += re.String()
	}

	return match(s)
}
8.
nbari/violetear · dynamic.go
Match rating: 55.59% · See similar code snippets
go logo
func (d dynamicSet) Set(name, regex string) error {
	if !strings.HasPrefix(name, ":") {
		return errors.New("dynamic route name must start with a colon ':'")
	}

	// fix regex
	if !strings.HasPrefix(regex, "^") {
		regex = fmt.Sprintf("^%s$", regex)
	}

	r := regexp.MustCompile(regex)
	d[name] = r

	return nil
}
9.
microcosm-cc/bluemonday · policy.go
Match rating: 55.46% · See similar code snippets
go logo
func (abp *attrPolicyBuilder) Matching(regex *regexp.Regexp) *attrPolicyBuilder {

	abp.regexp = regex

	return abp
}
10.
intervention-engine/fhir · mongo_search.go
Match rating: 54.97% · See similar code snippets
go logo
func ci(s string) bson.RegEx {
	return bson.RegEx{Pattern: fmt.Sprintf("^%s$", regexp.QuoteMeta(s)), Options: "i"}
}