Export (0) Print
Expand All

source Property

Returns a copy of the text of the regular expression pattern. Read-only.

rgExp.source

Arguments

rgExp
Required. A Regular Expression object.

Remarks

The rgExp can be a variable that stores a Regular Expression object, or it can be a regular expression literal.

Example

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.

Requirements

Version 3

See Also

Regular Expression Object | Regular Expression Syntax

Applies To: Regular Expression Object

Show:
© 2014 Microsoft