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

Method FindAllStringIndex

regex.go:777–779  ·  view source on GitHub ↗

FindAllStringIndex returns a slice of all successive matches of the pattern in s, as index pairs [start, end]. If n > 0, it returns at most n matches. If n <= 0, it returns all matches. Example: re := coregex.MustCompile(`\d+`) indices := re.FindAllStringIndex("1 2 3", -1) // indices = [[0,1],

(s string, n int)

Source from the content-addressed store, hash-verified

775// indices := re.FindAllStringIndex("1 2 3", -1)
776// // indices = [[0,1], [2,3], [4,5]]
777func (r *Regex) FindAllStringIndex(s string, n int) [][]int {
778 return r.FindAllIndex(stringToBytes(s), n)
779}
780
781// ReplaceAllLiteral returns a copy of src, replacing matches of the pattern
782// with the replacement bytes repl.

Calls 2

FindAllIndexMethod · 0.95
stringToBytesFunction · 0.85