index (RegExp)
syntax: |
returnedArray.index |
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 index has the start position of the match in the target string.
|
see: |
input (RegExp), RegExp exec(), String match()
|
example: |
var str = "one tao three tio one"; var pat = /(t.o)\s(t.r)/g; var rtn = pat.exec(str); // rtn[0] == "tao thr" // rtn[1] == "tao" // rtn[2] == "thr" // rtn.index == 4 // rtn.input == "one tao three tio one" |