MCPcopy
hub / github.com/simstudioai/sim / escapeRegex

Function escapeRegex

packages/emcn/src/components/code/code.tsx:831–833  ·  view source on GitHub ↗

* Escapes special regex characters in a string.

(str: string)

Source from the content-addressed store, hash-verified

829 * Escapes special regex characters in a string.
830 */
831function escapeRegex(str: string): string {
832 return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
833}
834
835/**
836 * Applies search highlighting to already syntax-highlighted HTML.

Callers 3

applySearchHighlightingFunction · 0.70
code.tsxFile · 0.70

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected