rsuite
Version:
A suite of react components
12 lines (11 loc) • 342 B
JavaScript
'use client';
;
exports.__esModule = true;
exports.getSafeRegExpString = getSafeRegExpString;
/**
* @description escape Regular_Expressions special_characters '^$.|*+?{\\[()'
*/
function getSafeRegExpString(str) {
const specialChars = '\\^$.|?*+()[]{}';
return str.replace(new RegExp(`([${specialChars}])`, 'g'), '\\$1');
}