Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

input Property ($_) 

Returns the string against which a regular expression search was performed.


//Syntax 1
{RegExp | reArray}.input

//Syntax 2
RegExp.$_
//The $_ property may be used as shorthand for the input property
//for the RegExp object.
RegExp

Required. The global RegExp object.

reArray

Required. An array returned by the exec method of a Regular Expression object.

The value of input property is the string against which a regular expression search was performed.

The initial value of the RegExp.input property is an empty string, "". Its value is read-only and changes whenever a successful match is made.

NoteNote

The properties of the RegExp object are not available when running in fast mode, the default for JScript. To compile a program from the command line that uses these properties, you must turn off the fast option by using /fast-. It is not safe to turn off the fast option in ASP.NET because of threading issues.

The following example illustrates the use of the input property:

var str : String = "A test string.";
var re : RegExp = new RegExp("\\w+","ig");
var arr : Array = re.exec(str);
print("The string used for the match was: " + arr.input);

The output of this program is:

The string used for the match was: A test string.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.