Please report any other irregularities here.
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:184.108.40.206) Gecko/20061204 Firefox/220.127.116.11 Build Identifier: 1.6R5 Rhino RegExp doesn't behave correctly (at least not like RegExp in Firefox or in Java). It seems that not capturing group is not interpreted correctly. Reproducible: Always Steps to Reproduce: var re = new RegExp("(?:<script.*?>)(.*)<\/script>") var t = 'foo <script>boo();</script>bar' var r = re.exec(t) if (r != "boo();") throw "Bad result: " + r else println("ok") Sadly the RegExp is too tighly binded to String what makes impossible to just define own version of RegExp based on Java 1.4 regex
Another example from Rhino 1.7: var str = "<xy"; var matches = str.match(/(?:<<)xy/); print(matches.join(", ")); matches should be null but is actually ["<xy"]. Make the group a capturing group and things work as expected. var str = "<xy"; var matches = str.match(/(<<)xy/); print(matches.join(", "));
My patch in pull request #19 ( https://github.com/mozilla/rhino/pull/19 ) will fix this bug.
I merged Masami's pull request.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.