How to escape regular expression in javascript ?
        Posted  
        
            by Relax
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Relax
        
        
        
        Published on 2010-04-07T15:15:08Z
        Indexed on 
            2010/04/07
            15:23 UTC
        
        
        Read the original article
        Hit count: 238
        
My codes is like
pattern = 'arrayname[1]'; // fetch from dom, make literal here just for example
reg = new RegExp(RegExp.quote(pattern), 'g');
mystring.replace(reg, 'arrayname[2]');
But it just cannot get running with error message says: "RegExp.quote is not a function", am i missing something simple?
© Stack Overflow or respective owner