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:
В | Copy Code |
---|---|
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:
В | Copy Code |
---|---|
The string Spain contains in. |