JavaScript tutorial:
index property

 

Applies To: RegExp Object

The index property returns the character position where the first successful match begins in a searched string.

Syntax

RegExp.index

Return value

Returns the character position where the first successful match begins in a searched string.

Remarks

The index property is zero-based. Its value is modified whenever a successful match is made.

See Also: RegExp Object Properties Regular Expression Syntax