2 ms·
You can use String.raw: new RegExp(String.raw`\s`) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/raw https://devel
by snek 7y ago
You can use String.raw:
new RegExp(String.raw`\s`)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/raw https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- zzo38computer 7y agoNo, that is something different.
- snek 7y agoYes, but it works quite well for this task.
- anderskaseorg 7y agoIt has nothing to do with this task. function replaceAll(str: string, pattern: string, replacement: string): string { return str.replace(new RegExp(escapeForRegExp(pattern), "g"), replacement); }