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

Function Regexp

internal/testify/assert/assertions.go:1634–1646  ·  view source on GitHub ↗

Regexp asserts that a specified regexp matches a string. assert.Regexp(t, regexp.MustCompile("start"), "it's starting") assert.Regexp(t, "start...$", "it's not starting")

(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

1632// assert.Regexp(t, regexp.MustCompile("start"), "it's starting")
1633// assert.Regexp(t, "start...$", "it's not starting")
1634func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
1635 if h, ok := t.(tHelper); ok {
1636 h.Helper()
1637 }
1638
1639 match := matchRegexp(rx, str)
1640
1641 if !match {
1642 Fail(t, fmt.Sprintf("Expect \"%v\" to match \"%v\"", str, rx), msgAndArgs...)
1643 }
1644
1645 return match
1646}
1647
1648// NotRegexp asserts that a specified regexp does not match a string.
1649//

Callers 7

RegexpFunction · 0.92
RegexpfFunction · 0.70
TestStringEqualFunction · 0.70
TestEqualFormattingFunction · 0.70
TestRegexpFunction · 0.70
RegexpMethod · 0.70

Calls 4

matchRegexpFunction · 0.85
SprintfMethod · 0.80
FailFunction · 0.70
HelperMethod · 0.45

Tested by 4

TestStringEqualFunction · 0.56
TestEqualFormattingFunction · 0.56
TestRegexpFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…