MCPcopy
hub / github.com/jestjs/jest / escapeStrForRegex

Function escapeStrForRegex

packages/jest-regex-util/src/index.ts:20–21  ·  view source on GitHub ↗
(string: string)

Source from the content-addressed store, hash-verified

18};
19
20export const escapeStrForRegex = (string: string): string =>
21 string.replaceAll(/[$()*+.?[\\\]^{|}]/g, '\\$&');
22
23export const replacePathSepForRegex = (string: string): string => {
24 if (sep === '\\') {

Callers 2

joinForPatternFunction · 0.90
escapePathForRegexFunction · 0.85

Calls

no outgoing calls

Tested by 1

joinForPatternFunction · 0.72