Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js |
— | — | @@ -1,10 +1,4 @@ |
2 | 2 | /** |
3 | | - * Extend the RegExp object with an escaping function |
4 | | - * From http://simonwillison.net/2006/Jan/20/escape/ |
5 | | - */ |
6 | | -RegExp.escape = function( s ) { return s.replace(/([.*+?^${}()|\/\\[\]])/g, '\\$1'); }; |
7 | | - |
8 | | -/** |
9 | 3 | * Dialog Module for wikiEditor |
10 | 4 | */ |
11 | 5 | ( function( $ ) { $.wikiEditor.modules.dialogs = { |
Index: trunk/extensions/WikiEditor/modules/ext.wikiEditor.dialogs.js |
— | — | @@ -507,7 +507,7 @@ |
508 | 508 | open: function() { |
509 | 509 | // Cache the articlepath regex |
510 | 510 | $(this).data( 'articlePathRegex', new RegExp( |
511 | | - '^' + RegExp.escape( wgServer + wgArticlePath ) |
| 511 | + '^' + ( wgServer + wgArticlePath ).escapeRE() |
512 | 512 | .replace( /\\\$1/g, '(.*)' ) + '$' |
513 | 513 | ) ); |
514 | 514 | // Pre-fill the text fields based on the current selection |
— | — | @@ -980,7 +980,7 @@ |
981 | 981 | flags += 'g'; |
982 | 982 | } |
983 | 983 | if ( !isRegex ) { |
984 | | - searchStr = RegExp.escape( searchStr ); |
| 984 | + searchStr = searchStr.escapeRE(); |
985 | 985 | } |
986 | 986 | try { |
987 | 987 | var regex = new RegExp( searchStr, flags ); |