Hit end position

Syntax

	$match.regexEnd()

$match.regexEnd($index)

Description

Returns the final 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 end positions for each search hit.

Examples

Without index

	regex("b+a").regexSearch("XXXbbbaYYYbba").regexEnd()

Output: [7, 13]

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

With index

	regex("(b+)a").regexSearch("XXXbbbaYYYbba").regexEnd(1)

Output: [6, 12]

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