6 lines
171 B
JavaScript
6 lines
171 B
JavaScript
/**
|
|
* @see https://stackoverflow.com/a/6969486
|
|
* @param {string}
|
|
* @returns {string}
|
|
*/
|
|
export const regExpEscape = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|