Return to Snippet

Revision: 80614
at March 23, 2020 05:12 by chrisaiv

Updated URL

Updated Code

Updated Description

Revision: 5105
at February 11, 2008 22:42 by chrisaiv

Initial Code
//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[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, '"');

Initial URL

Initial Description
The first example strips out the HTML.

The second example shows how to target a single quote using unicode.

Initial Title
AS3: Regular Expression Basic example

Initial Tags

Initial Language
ActionScript 3