MCPcopy Create free account
hub / github.com/cortexkit/magic-context / escapeRegex

Function escapeRegex

packages/plugin/src/shared/redaction.ts:3–5  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

1import { homedir, userInfo } from "node:os";
2
3function escapeRegex(value: string): string {
4 return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5}
6
7// Whole-segment match: the key (or its components when split on common
8// separators) must BE one of these words, not merely contain them as a

Callers 1

sanitizePathStringFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected