MCPcopy Create free account
hub / github.com/coregx/coregex / MatchString

Method MatchString

regex.go:295–297  ·  view source on GitHub ↗

MatchString reports whether the string s contains any match of the pattern. This is a zero-allocation operation (like Rust's is_match). Example: re := coregex.MustCompile(`hello`) if re.MatchString("hello world") { println("matched!") }

(s string)

Source from the content-addressed store, hash-verified

293// println("matched!")
294// }
295func (r *Regex) MatchString(s string) bool {
296 return r.engine.IsMatch(stringToBytes(s))
297}
298
299// Find returns a slice holding the text of the leftmost match in b.
300// Returns nil if no match is found.

Callers 15

TestUnmarshalTextFunction · 0.95
MatchReaderMethod · 0.95
TestStdlibCompat_MatchFunction · 0.80
FuzzMatchStdlibFunction · 0.80
TestWordBoundaryFunction · 0.80
TestNoWordBoundaryFunction · 0.80
TestWordBoundaryVsStdlibFunction · 0.80

Calls 2

stringToBytesFunction · 0.85
IsMatchMethod · 0.45

Tested by 15

TestUnmarshalTextFunction · 0.76
TestStdlibCompat_MatchFunction · 0.64
FuzzMatchStdlibFunction · 0.64
TestWordBoundaryFunction · 0.64
TestNoWordBoundaryFunction · 0.64
TestWordBoundaryVsStdlibFunction · 0.64
TestIssue12_WordBoundaryFunction · 0.64