all files / modules/utils/ escapeRegExp.js

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3
1 2 3 4 5 6 7 8 9      24×      
/**
 * Escapes all special RegExp characters in the given string.
 */
function escapeRegExp(string) {
    return String(string).replace(/([.?*+^$[\]\\(){}-])/g, "\\$1");
}
 
module.exports = escapeRegExp;