Merge "Improve sorting on SpecialWanted*-Pages"
[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
9 * The following characters are escaped:
11 * \ { } ( ) | . ? * + - ^ $ [ ]
13 * @since 1.26
14 * @static
15 * @param {string} str String to escape
16 * @return {string} Escaped string
18 escape: function ( str ) {
19 return str.replace( /([\\{}()|.?*+\-\^$\[\]])/g, '\\$1' );
22 }( mediaWiki ) );