contents   index   previous   next



input (RegExp)

syntax:

returnedArray.input

description:

When String match()is called and the "g" is not used in the regular expression, String match() returns an array with two extra properties, index and input. The property input has a copy of the target string.

 

see:

index (RegExp), RegExp exec(), String match()

 

example:

var str = "one two three two one";

var pat = /(t.o)\s(t.r)/g;

var rtn = pat.exec(str);

   // rtn[0] == "two thr"

   // rtn[1] == "two"

   // rtn[2] == "thr"

   // rtn.index == 4

   // rtn.input == "one two three two one"

 


RegExp object instance methods