keybase/client · utils.go
go logo
func GetQueryRe(query string) (*regexp.Regexp, error) {
	return regexp.Compile("(?i)" + regexp.QuoteMeta(query))
}
Similar code snippets
1.
cosiner/gohper · regexp.go
Match rating: 69.59% · See similar code snippets
go logo
func compile(expr string, compFunc func(string) (*regexp.Regexp, error)) (*Regexp, error) {
	r, err := compFunc(expr)
	if err != nil {
		return nil, err
	}

	return &Regexp{Regexp: r}, nil
}
2.
ddliu/go-requery · util.go
Match rating: 67.31% · See similar code snippets
go logo
func getRegexp(re interface{}) *regexp.Regexp {
    switch t := re.(type) {
    case string:
        return regexp.MustCompile(t)
    case *regexp.Regexp:
        return t
    default:
        panic("not a regexp")
    }
}
3.
mattn/anko · regexp.go
Match rating: 66.67% · See similar code snippets
go logo
func init() {
	Packages["regexp"] = map[string]interface{}{
		"Match":            regexp.Match,
		"MatchReader":      regexp.MatchReader,
		"MatchString":      regexp.MatchString,
		"QuoteMeta":        regexp.QuoteMeta,
		"Compile":          regexp.Compile,
		"CompilePOSIX":     regexp.CompilePOSIX,
		"MustCompile":      regexp.MustCompile,
		"MustCompilePOSIX": regexp.MustCompilePOSIX,
	}
}
4.
juju/juju · model.go
Match rating: 66.32% · See similar code snippets
go logo
func (m *Model) machineRegexp() (*regexp.Regexp, error) {
	regExp := fmt.Sprintf("^%s$", names.NumberSnippet)
	return regexp.Compile(regExp)
}
5.
keybase/client · server.go
Match rating: 65.87% · See similar code snippets
go logo
func (h *Server) getSearchRegexp(query string, opts chat1.SearchOpts) (re *regexp.Regexp, err error) {
	if opts.IsRegex {
		re, err = regexp.Compile(query)
	} else {
		// String queries are set case insensitive
		re, err = utils.GetQueryRe(query)
	}
	if err != nil {
		return nil, err
	}
	return re, nil
}
6.
prometheus/prometheus · relabel.go
Match rating: 65.66% · See similar code snippets
go logo
func NewRegexp(s string) (Regexp, error) {
	regex, err := regexp.Compile("^(?:" + s + ")$")
	return Regexp{
		Regexp:   regex,
		original: s,
	}, err
}
7.
koyachi/go-term-ansicolor · cdiff.go
Match rating: 65.4% · See similar code snippets
go logo
func compiledRegexp(reStr string) *regexp.Regexp {
	re, err := regexp.Compile(reStr)
	if err != nil {
		log.Fatal(err)
	}
	return re
}
8.
quorumsco/elastic · search_queries_regexp.go
Match rating: 64.76% · See similar code snippets
go logo
func NewRegexpQuery(name string, regexp string) RegexpQuery {
	return RegexpQuery{name: name, regexp: regexp}
}
9.
mb0/glob · glob.go
Match rating: 64.29% · See similar code snippets
go logo
func (c Config) metaRegexp() (*regexp.Regexp, error) {
	meta := regexp.QuoteMeta(string([]byte{c.Star, c.Quest, c.Range}))
	return regexp.Compile(`(^|[^\\])[` + meta + `]`)
}
10.
digota/digota · payment.go
Match rating: 63.48% · See similar code snippets
go logo
func WriteMethods() []*regexp.Regexp {
	return []*regexp.Regexp{
		regexp.MustCompile(baseMethod + "NewCharge"),
		regexp.MustCompile(baseMethod + "RefundCharge"),
	}
}