MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / escapeRegExp

Function escapeRegExp

console/src/util.ts:262–264  ·  view source on GitHub ↗
(literal: string)

Source from the content-addressed store, hash-verified

260 * Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions#escaping
261 */
262export function escapeRegExp(literal: string) {
263 return literal.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
264}
265
266/**
267 * Returns all values for given search param name, or a default.

Callers 2

buildRegexFunction · 0.90
updateFunction · 0.90

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected