Files
huly-platform/server-plugins/notification-resources/src/utils.ts
T
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)
}