Skip to content

Match - cRegEx

Finds the offset of the first 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 Match String sSubject Returns Integer

Call Example

Get Match sSubject to IntegerVariable

Description

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

Sample

The example below validates that sSubject is a valid number.

Object oNumberRegEx is a cRegEx 
    Set psExpression to "^\d+([.,]\d+)?$" 
End_Object 

Function IsValidNumber String sSubject Returns Boolean  
    Function_Return (Match(oNumberRegEx, sSubject) > 0) 
End_Function

Return Value

The offset (1-based) of the first match in the subject string; 0 if no matches are found.