See ECMA 262 v3 §15.5.4.14, pp.103,104 for details. The rules are complex and might seem almost arbitrary without close examination.

Code:

Expected:

Native (This Browser):

Fixed:

« XRegExp © 2008-2012 Steven Levithan. These tests are released under the MIT License.