source Property
Returns a copy of the text of the regular expression pattern. Read-only.
rgExp.source
The following example illustrates the use of the source property:
var src : String = "Spain";
var re : RegExp = /in/g;
var s1;
// Test string for existence of regular expression.
if (re.test(src))
s1 = " contains ";
else
s1 = " does not contain ";
// Get the text of the regular expression itself.
print("The string " + src + s1 + re.source + ".");
The output of this program is:
The string Spain contains in.
Show: