Status: New
Owner: ----

New issue 1813 by utatane.tea: String new RegExp('\n').toString() returns is invalid RegularExpressionLiteral
http://code.google.com/p/v8/issues/detail?id=1813

new RegExp('\n').toString() returns
/
/
, so this result is including LineTerminator.

And, according to ECMA262 section 15.10.6.4
"The returned String has the form of a RegularExpressionLiteral that evaluates to another RegExp object with the same behaviour as this object."
http://es5.github.com/#x15.10.6.4

And, because of RegularExpressionNonTerminator, LineTerminator is not allowed in RegularExpressionLiteral. So RegExp.source should be escaped.

Furthermore, new RegExp('\\\n').toString() should provide /\n/, because /\\\n/ doesn't have the same behaviour to new RegExp('\\\n').

I also reported it to WebKit JSC https://bugs.webkit.org/show_bug.cgi?id=71572, and created patch for V8.
This patch solves issue 956 at the same time.

Attachments:
        v1.patch  5.1 KB

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to