platform/server-plugins/notification-resources/src/utils.ts
Denis Bykhov 3a8d1e2bcb
Refactor server side notifications (#2327)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
2022-10-26 17:24:39 +07:00

8 lines
252 B
TypeScript

function escapeRegExp (str: string): string {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
}
export function replaceAll (str: string, find: string, replace: string): string {
return str.replace(new RegExp(escapeRegExp(find), 'g'), replace)
}