MCPcopy Create free account
hub / github.com/sergi/go-diff / ExampleDiffMatchPatch_MatchMain

Function ExampleDiffMatchPatch_MatchMain

diffmatchpatch/example_test.go:106–117  ·  view source on GitHub ↗

Locate a pattern in the text, exactly or fuzzily.

()

Source from the content-addressed store, hash-verified

104
105// Locate a pattern in the text, exactly or fuzzily.
106func ExampleDiffMatchPatch_MatchMain() {
107 dmp := diffmatchpatch.New()
108
109 text := "The quick brown fox jumps over the lazy dog."
110
111 fmt.Println(dmp.MatchMain(text, "quick brown", 0))
112 fmt.Println(dmp.MatchMain(text, "quick grown", 0)) // typo, still found
113
114 // Output:
115 // 4
116 // 4
117}
118
119// Cleanup shifts edits to word boundaries: the raw diff on the left
120// splits words, the cleaned up diff on the right edits whole words.

Callers

nothing calls this directly

Calls 2

NewFunction · 0.92
MatchMainMethod · 0.80

Tested by

no test coverage detected