Skip to content

RMatch - cRegEx

Finds the offset of the last match in the subject string

Type: Function
Return Data Type: Integer

Parameters

Parameter Type Description
sSubject String The host string to run the regular expression on

Syntax

Function RMatch String sSubject Returns Integer

Call Example

Get RMatch sSubject to IntegerVariable

Description

Finds the offset of the last match in the subject string (0 if no match).

Returns the offset of the last match in the subject string. The position is 1 based and 0 is returned if no match is found.

Sample

The example below shows how to find separators in a string. iLastPos will be 10 and iFirstPos will be 2.

Handle hoRegEx 
Integer iFirstPos iLastPos 

Get Create (RefClass(cRegEx)) to hoRegEx 
Set psExpression of hoRegEx to "[;,\t ]" 

Get RMatch of hoRegEx "1,2,3,4,5,6" to iLastPos 
Get Match of hoRegEx "1,2,3,4,5,6" to iFirstPos 

Send Destroy of hoRegEx

Return Value

The offset of the last match in the subject string (0 if no match).