(string: string)
| 81 | }; |
| 82 | |
| 83 | function escapeRegExp(string: string) { |
| 84 | return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string |
| 85 | } |
| 86 | |
| 87 | export const replaceAllUtil = (str: string, find: string, replace: string) => |
| 88 | str.replace(new RegExp(escapeRegExp(find), "g"), replace); |