The current implementation of deepEqual for RegExp objects is good. Specifically, it's great that it doesn't compare lastIndex properties. However, the current implementation ignores the /y flag and its corresponding sticky property, which should be added to the list of comparisons.
Aside: ES6 will add support for two new RegExp flags: /y and /u. The /y flag is already supported in Firefox 3+, and has the corresponding property RegExp.prototype.sticky. The /u flag will likely show up with the property name unicode, but since that's not in writing anywhere, at the moment, it would probably be best to wait until the first implementations for /u show up before comparing unicode properties.
Thanks for bringing this Steven. I will look to add support for the sticky flag.
I have a fix for this, but grunt won't run the tests because "y" is still an invalid flag and hasn't been implemented (I'm assuming in PhantomJS). Is there a way to test it? With just the change, the tests all pass, but that's because none of the RegExp tests are trying to build a regular expression with the sticky flag.
Fix to allow deepEqual to compare the "sticky" flag. Unfortunately grunt tests fail because the sticky flag hasn't been implemented and the RegExp constructor fails with an error and does not run the test cases.
deepEquals now examines the "sticky" property as well. Unfortunately, tests for this do not pass since the sticky flag isn't supported yet.
Removed breaking tests because using the "y" flag isn't supported in the RegExp constructor. deepEquals does look at the "sticky" flag, however.
Compare the ES6 sticky (y) property for RegExp. Can't add to tests ye…
…t. Fixes #284 - deepEqual for RegExp should compare