These are the two main docs about RegEx class for AS3.0. If you already know re’s from some other language (e.g., Perl, Javascript, etc.), these will be famliar, and the only necessary reference:

Inner syntax:
Outer syntax:

A RegEx can be used in a string.replace() command or other locations.

RegEx in ActionScript, like XML, has two constructors: with quotes or without (examples from Adobe’s RegEx class reference):


var pattern1:RegExp = new RegExp("test-\\d", "i");

Without quotes:

var pattern2:RegExp = /test-\d/i;

Because these are constructors, they create a new RegEx invisibly, so can be used as function parameters (as in string.replace()) without further declaration:

var str:String = "test-12345";
str.replace("test-(\\d)", "replaced-\\1");
str.replace(/test-(\d)/i, "replaced-\\1");

– 30 –