Inline regexps and caching

Mark S. Miller erights at
Fri Jan 23 07:54:52 PST 2009

On Fri, Jan 23, 2009 at 7:33 AM, Mike Shaver <mike.shaver at> wrote:

> Firefox and Opera are doing what ES3 requires (s 7.8.5:
> ),


> but I believe that it's being
> changed in 3.1 to produce a new one each time the literal expression
> is executed.

Correct. In the meantime, you can change expressions like

    var regexp = /^[^d]*\bd{1,4}\b[^d]*$/g;


    var regexp = new RegExp("^[^d]*\\bd{1,4}\\b[^d]*$","g");

Yes, this is ugly. But an ugly program that works is better than a pretty
one that doesn't.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Es-discuss mailing list