Files
talk/services/regex.js
T
2017-10-11 16:41:09 -06:00

11 lines
234 B
JavaScript

/**
* Escape string for special regular expression characters.
*/
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}
module.exports = {
escapeRegExp,
};