Namespace comb.regexp
Regeular expression utilities
Defined in: regexp.js.
Namespace Detail
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;
});
}
Method Detail
<static>
{String}
comb.regexp.escapeString(str, except)
Escapes a string
- Parameters:
- {String} str
- the string to escape
- {String} except Optional
- characters to ignore
- Returns:
- {String} the escaped string
return str.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, function(ch) {
if (except && except.indexOf(ch) != -1) {
return ch;
}
return "\\" + ch;
});
Documentation generated by JsDoc Toolkit 2.4.0 on Tue Jan 31 2012 16:14:12 GMT-0600 (CST)