PIbd-21_Danilov_V.V._Intern.../Lab4/node_modules/escape-string-regexp/index.js
Владимир Данилов ab1cc7aeac Отчет лаб 4
2024-01-09 05:30:48 +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, '\\$&');
};