MCPcopy Index your code
hub / github.com/colbymchenry/codegraph / globToRegex

Method globToRegex

src/mcp/tools.ts:4113–4121  ·  view source on GitHub ↗

* Convert glob pattern to regex

(pattern: string)

Source from the content-addressed store, hash-verified

4111 * Convert glob pattern to regex
4112 */
4113 private globToRegex(pattern: string): RegExp {
4114 const escaped = pattern
4115 .replace(/[.+^${}()|[\]\\]/g, '\\$&') // Escape special regex chars except * and ?
4116 .replace(/\*\*/g, '{{GLOBSTAR}}') // Temp placeholder for **
4117 .replace(/\*/g, '[^/]*') // * matches anything except /
4118 .replace(/\?/g, '[^/]') // ? matches single char except /
4119 .replace(/\{\{GLOBSTAR\}\}/g, '.*'); // ** matches anything including /
4120 return new RegExp(escaped);
4121 }
4122
4123 /**
4124 * Format files as a flat list

Callers 1

handleFilesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected