Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.0   7.1   7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3    Statistic  

RegEx.Results

Queries the result from execute.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
RegEx 4.4 Yes Yes Yes Yes Yes

MBS( "RegEx.Results"; RegExRef )

Parameters

Parameter Description Example value
RegExRef The reference number for the regular expression returned from RegEx.Compile. $regex

Result

Returns OK or error.

Description

Queries the result from execute.
The result are offsets into the text to search. Two for the whole match followed by 2 for each sub pattern.

Examples

Loop and find all matches for pattern:

Set Variable [ $pattern ; Value: "(USt\-?ID:?|USt\-?IdNR\.?:?|Umsatzsteuer\-?ID:?|VAT\-?ID:?)[\s]?(DE)[\s]?([0-9]{9})" ]
Set Variable [ $ExecuteOptions ; Value: 0 ]
Set Variable [ $CompileOptions ; Value: "caseless" ]
Set Variable [ $regex ; Value: MBS("RegEx.Compile"; $Pattern; $CompileOptions) ]
Set Variable [ $offset ; Value: 0 ]

Loop
    Set Variable [ $r ; Value: MBS("RegEx.Execute"; $regex; RegEx::Text; $ExecuteOptions; $offset) ]
    Exit Loop If [ $r < 4 ]
    Set Variable [ $s1 ; Value: MBS("RegEx.Substring"; $RegEx; 1) ]
    Set Variable [ $s2 ; Value: MBS("RegEx.Substring"; $RegEx; 2) ]
    Set Variable [ $s3 ; Value: MBS("RegEx.Substring"; $RegEx; 3) ]
    Show Custom Dialog [ $s1 & ¶ & $s2 & ¶ & $s3 ]
    Exit Loop If [ MBS("IsError") ]
    Set Variable [ $offset ; $offset + Value: GetAsNumber(GetValue(MBS("RegEx.Results"; $regex); 2)) ]
End Loop
Set Variable [ $r ; Value: MBS("RegEx.Free"; $RegEx) ]

See also


RegEx.ReplaceAll   -   RegEx.Size

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins