MCPcopy Create free account
hub / github.com/dailydotdev/apps / escapeRegexCharacters

Function escapeRegexCharacters

packages/shared/src/lib/strings.ts:60–62  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

58 * @returns The escaped string safe for use in RegExp
59 */
60export const escapeRegexCharacters = (str: string): string => {
61 return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
62};
63
64export const pluralize = (word: string, count: number, append = 's') =>
65 `${word}${count === 1 ? '' : append}`;

Callers 3

BlockedUserListFunction · 0.90
BlockedSourceListFunction · 0.90
BlockedTagListFunction · 0.90

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected