9 lines
No EOL
314 B
JavaScript
9 lines
No EOL
314 B
JavaScript
/*@
|
|
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
|
|
Ox.escapeRegExp = function(string) {
|
|
return (string + '').replace(/([\/\\^$*+?.-|(){}[\]])/g, '\\$1');
|
|
}; |