Regeular expression utilities
Source{ /**@lends comb.regexp*/ /** * Escapes a string * * @param {String} str the string to escape * @param {String} [except] characters to ignore * * @returns {String} the escaped string */ escapeString:function (str, except) { return str.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, function (ch) { if (except && except.indexOf(ch) !== -1) { return ch; } return "\\" + ch; }); // String } }
Escapes a string
Argumentsthe string to escape
characters to ignore
String
the escaped string
function (str,except){ return str.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, function (ch) { if (except && except.indexOf(ch) !== -1) { return ch; } return "\\" + ch; }); // String }
MIT https://github.com/C2FO/comb/raw/master/LICENSE
git clone git://github.com/C2FO/comb.git