blob: 91cdc2d155df48d8d1da77df947f16afd9b2de10 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
( function ( mw ) {
/**
* @class mw.RegExp
*/
mw.RegExp = {
/**
* Escape string for safe inclusion in regular expression
*
* The following characters are escaped:
*
* \ { } ( ) | . ? * + - ^ $ [ ]
*
* @since 1.26
* @static
* @param {string} str String to escape
* @return {string} Escaped string
*/
escape: function ( str ) {
return str.replace( /([\\{}()|.?*+\-^$\[\]])/g, '\\$1' ); // eslint-disable-line no-useless-escape
}
};
}( mediaWiki ) );
|