I have a user supplied text and I need to prepend all backslashes and single quotes with a backslash. How to do that?
                +4 
                A: 
                
                
              
            var string:String = "something 'is' \\fishy here";
trace(string);//something 'is' \fishy here
string = string.replace(/(['\\])/g, "\\$1");
trace(string);//something \'is\' \\fishy here
                  Amarghosh
                   2009-11-29 16:40:59
                
              
                +2 
                A: 
                
                
              
            Amarghosh's answer is spot on. If you want an easy way to test out AS3 regex, Grant Skinner's Regexr is awesome.
                  Joel Hooks
                   2009-11-29 16:45:49