MCPcopy
hub / github.com/expr-lang/expr / matchRegexp

Function matchRegexp

internal/testify/assert/assertions.go:1617–1628  ·  view source on GitHub ↗

matchRegexp return true if a specified regexp matches a string.

(rx interface{}, str interface{})

Source from the content-addressed store, hash-verified

1615
1616// matchRegexp return true if a specified regexp matches a string.
1617func matchRegexp(rx interface{}, str interface{}) bool {
1618
1619 var r *regexp.Regexp
1620 if rr, ok := rx.(*regexp.Regexp); ok {
1621 r = rr
1622 } else {
1623 r = regexp.MustCompile(fmt.Sprint(rx))
1624 }
1625
1626 return (r.FindStringIndex(fmt.Sprint(str)) != nil)
1627
1628}
1629
1630// Regexp asserts that a specified regexp matches a string.
1631//

Callers 2

RegexpFunction · 0.85
NotRegexpFunction · 0.85

Calls 1

SprintMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…