PIbd-21_Danilov_V.V._Intern.../Lab3/node_modules/escape-string-regexp/index.js
Владимир Данилов 83490711d5 отчет
2023-12-19 20:23:11 +04:00

12 lines
226 B
JavaScript

'use strict';
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
module.exports = function (str) {
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
return str.replace(matchOperatorsRe, '\\$&');
};