Regex.startIndex
startIndex($index)
Description
Set the position within the matched string, from which to start applying the regex. (Default: 1)
A negative $index
counts from the end of the matched string.
$nums = '123 456 789' $nums.match(r'\d+'.startIndex(4)) //= '456' $nums.match(r'\d+'.startIndex(-4)) //= '789'