/ Published in: ActionScript 3
The first example strips out the HTML.
The second example shows how to target a single quote using unicode.
Expand |
Embed | Plain Text
//////////////////////////////////////////// //Example 1: //////////////////////////////////////////// var re:RegExp = /<font face=\u0022(.*)\u0022 >(.*)<\/font>/i; var str:String = '<P ALIGN="LEFT"><FONT FACE="Arial" >this is a test</FONT></P>'; var result:Object = re.exec(str); trace(result[1]);//Arial trace(result[2]);//this is a test //////////////////////////////////////////// //Example 2: Replace all of the single quotes with double //////////////////////////////////////////// var str2:String = "This 'is' the 'first' time 'ever'"; str2 = str2.replace(/\u0027+/g, '"'); trace(str2);
You need to login to post a comment.
