Merge "Remove not used private member variable mParserWarnings from OutputPage"
[mediawiki.git] / resources / src / mediawiki / mediawiki.RegExp.js
blob1da4ab4c2240ebfd41f4eaa70c7712972248be4a
1 ( function ( mw ) {
2         /**
3          * @class mw.RegExp
4          */
5         mw.RegExp = {
6                 /**
7                  * Escape string for safe inclusion in regular expression
8                  *
9                  * The following characters are escaped:
10                  *
11                  *     \ { } ( ) | . ? * + - ^ $ [ ]
12                  *
13                  * @since 1.26
14                  * @static
15                  * @param {string} str String to escape
16                  * @return {string} Escaped string
17                  */
18                 escape: function ( str ) {
19                         return str.replace( /([\\{}()|.?*+\-\^$\[\]])/g, '\\$1' );
20                 }
21         };
22 }( mediaWiki ) );