Skip to content

Commit

Permalink
morebits: fix issue wikimedia-gadgets#70 - regexp escaping code
Browse files Browse the repository at this point in the history
Hardly pressing, but worth doing.
  • Loading branch information
atlight authored and Siddhartha-Ghai committed Oct 22, 2012
1 parent 1b5271a commit 5ecf5db
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions morebits.js
Original file line number Diff line number Diff line change
Expand Up @@ -783,14 +783,9 @@ HTMLFormElement.prototype.getChecked = function( name, type ) {

RegExp.escape = function( text, space_fix ) {

if ( !arguments.callee.sRE ) {
arguments.callee.sRE = /(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\|\$|\^)/g;
}

text = text.replace( arguments.callee.sRE , '\\$1' );
text = $.escapeRE(text);

// Special MediaWiki escape - underscore/space are often equivalent

if( space_fix ) {
text = text.replace( / |_/g, '[_ ]' );
}
Expand Down

0 comments on commit 5ecf5db

Please sign in to comment.