Hit start position

Syntax

	$match.regexStart()

$match.regexStart($index)

Description

Returns the start position of the given search hit in the search text.

Parameters

Name Type Description Mandatory Default
match Business object The list of search hits from which the start positions are to be determined. yes
index Number Only groups with the index will be considered no 0 - returns the full text of the search hit

Return value

Type: Set

A set with starting positions for each search hit.

Examples

Without index

	regex("ab+").regexSearch("XXXabbbYYYabb").regexStart()

Output: [3, 10]

The a of the first search hit has position 3 in the string (counting starts at 0). The a of the second search hit has the position 10 in the string.

With index

	regex("a(b+)").regexSearch("XXXabbbYYYabb").regexStart(1)

Output: [4, 11]

Only the group (b+) is considered instead of the whole search hit. The b of the first search hit has the position 4 in the string. The b of the second search hit has the position 11 in the string.