MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / buildTokenRegex

Function buildTokenRegex

src/core/tools/EditFileTool.ts:118–126  ·  view source on GitHub ↗
(oldLF: string)

Source from the content-addressed store, hash-verified

116}
117
118function buildTokenRegex(oldLF: string): RegExp {
119 const tokens = oldLF.split(/\s+/).filter(Boolean)
120 if (tokens.length === 0) {
121 return new RegExp("(?!)", "g")
122 }
123
124 const pattern = tokens.map(escapeRegExp).join("\\s+")
125 return new RegExp(pattern, "g")
126}
127
128function countRegexMatches(content: string, regex: RegExp): number {
129 const stable = new RegExp(regex.source, regex.flags)

Callers 1

executeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected