MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / globToRegex

Method globToRegex

src/mcp/tools.ts:4479–4487  ·  view source on GitHub ↗

* Convert glob pattern to regex

(pattern: string)

Source from the content-addressed store, hash-verified

4477 * Convert glob pattern to regex
4478 */
4479 private globToRegex(pattern: string): RegExp {
4480 const escaped = pattern
4481 .replace(/[.+^${}()|[\]\\]/g, '\\$&') // Escape special regex chars except * and ?
4482 .replace(/\*\*/g, '{{GLOBSTAR}}') // Temp placeholder for **
4483 .replace(/\*/g, '[^/]*') // * matches anything except /
4484 .replace(/\?/g, '[^/]') // ? matches single char except /
4485 .replace(/\{\{GLOBSTAR\}\}/g, '.*'); // ** matches anything including /
4486 return new RegExp(escaped);
4487 }
4488
4489 /**
4490 * Format files as a flat list

Callers 1

handleFilesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected