2012-05-19 06:36:02 +00:00
|
|
|
/*@
|
|
|
|
Ox.escapeRegExp <f> Escapes a string for use in a regular expression
|
|
|
|
(str) -> <r> Escaped string
|
|
|
|
str <s> String
|
|
|
|
@*/
|
|
|
|
// see https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions
|
2012-05-25 12:32:17 +00:00
|
|
|
Ox.escapeRegExp = function(string) {
|
|
|
|
return (string + '').replace(/([\/\\^$*+?.-|(){}[\]])/g, '\\$1');
|
2012-05-19 06:36:02 +00:00
|
|
|
};
|