mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 00:37:47 +00:00
8 lines
252 B
TypeScript
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)
|
|
}
|