MCPcopy Create free account
hub / github.com/continuedev/continue / escapeLiteralForRegex

Function escapeLiteralForRegex

core/util/regexValidator.ts:103–106  ·  view source on GitHub ↗
(literal: string)

Source from the content-addressed store, hash-verified

101 * @returns Escaped string safe for regex use
102 */
103export function escapeLiteralForRegex(literal: string): string {
104 // Escape all regex metacharacters
105 return literal.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
106}
107
108/**
109 * Detects if a query looks like it's meant to be a literal search

Callers 1

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected