azatoth/twinkle — Issue #70: RegExp.escape shoud escape "-"
Author: mybugs
Created: 2011-10-25 20:22:59+00:00
State: open

Currently,
https://github.com/azatoth/twinkle/blob/2d5caddb7f70054457538fece23fcd9bb3aacdd7/morebits.js#L684
the function RegExp.escape doesn't escape the following character: "-".
This may cause problems in some cases, so I think it is good idea to replace the current regular expression
/(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\|\$|\^)/g
by
/([\\{}()|.?*+\-^$\[\]])/g
which is the same used on $.escapeRE() which comes with MediaWiki.

See also:
http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/resources/jquery/jquery.mwExtension.js?view=markup#l17
https://bugzilla.wikimedia.org/show_bug.cgi?id=27848
https://bugzilla.wikimedia.org/show_bug.cgi?id=27960