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

Function escapeRegexCharacters

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

Source from the content-addressed store, hash-verified

52 * @returns The escaped string safe for use in RegExp
53 */
54export const escapeRegexCharacters = (str: string): string => {
55 return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
56};
57
58export const pluralize = (word: string, count: number, append = 's') =>
59 `${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