alexgorbatchev/SyntaxHighlighter — pull request #121 by slevithan (2012-05-22 14:58:35+00:00)
Title: Upgrade to XRegExp v2.0.0

I recently upgraded [XRegExp](https://github.com/slevithan/XRegExp) from v1.5.1 to v2.0.0. The (long) changelog is [here](http://xregexp.com/history/). Probably the most relevant changes for SyntaxHighlighter are that XRegExp no longer modifies any native methods by default, and no longer throws if it's (inappropriately) loaded twice in the same frame.

The attached commits also make the following changes:

* Renames `XRegExp.js` to `xregexp.js`, which is the casing for the original source file.
* Changes the `require` statement in `shCore.js` from `require('XRegExp').XRegExp` to `require('xregexp').XRegExp`. The [project on npm](http://search.npmjs.org/#/xregexp) uses the lowercase "xregexp", since npm requires lowercase project names.
* Removes the obsolete tests in `015_xregexp.html`. This isn't to say that any tests would be inappropriate, but the tests that were included are no longer relevant since XRegExp v2+ no longer overrides native methods by default.
* Cleans up regexes that use XRegExp. I've removed superfluous escapings and flags, etc., while taking care to make no functionality changes.

Note that since XRegExp no longer overrides native methods by default, it's safer than ever to distribute it with SyntaxHighlighter. However, if SyntaxHighlighter was *relying* on the cross-browser fixes that XRegExp v1.5.1 applied by automatically overriding native regex methods, there would be a couple ways to address this:

* Run `XRegExp.install('natives')` before running SyntaxHighlighter.
* Use XRegExp methods such as `XRegExp.exec`, `XRegExp.test`, `XRegExp.replace`, and `XRegExp.split`, rather than the corresponding native (and sometimes buggy) `RegExp` and `String` methods.

However, I suspect the above is not an issue.