2009-11-29 44 views

回答

5
var string:String = "something 'is' \\fishy here"; 
trace(string);//something 'is' \fishy here 
string = string.replace(/(['\\])/g, "\\$1"); 
trace(string);//something \'is\' \\fishy here 
2

Amarghosh的答案是現貨。如果你想要一個簡單的方法來測試AS3正則表達式,Grant Skinner's Regexr是真棒。