Defined base/regexp.js

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
    }
}
    

escapeString Static Function Public


Defined base/regexp.js

Escapes a string

Arguments Returns Source
function (str,except){
   return str.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, function (ch) {
       if (except && except.indexOf(ch) !== -1) {
           return ch;
       }
       return "\\" + ch;
   }); // String
       
}
    

License

MIT https://github.com/C2FO/comb/raw/master/LICENSE

Meta