Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

RegEx.CaptureCount

Queries number of captured sub patterns.

Component Version macOS Windows Linux Server iOS SDK
RegEx 4.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "RegEx.CaptureCount"; RegExRef )   More

Parameters

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

Result

Returns number or error.

Description

Queries number of captured sub patterns.

Examples

Run query:

Set Variable [ $Pattern ; Value: "H(.*)o (.)or(..)" ]
Set Variable [ $Text ; Value: "Hello World Test" ]
# Compile
Set Variable [ $Regex ; Value: MBS("RegEx.Compile"; $Pattern; "CaseLess") ]
If [ MBS("isError") ]
    Show Custom Dialog [ $Regex ]
    Exit Script [ Text Result: ]
End If
Set Variable [ $ExecuteResult ; Value: MBS("RegEx.Execute"; $RegEx; $Text; "") ]
If [ MBS("IsError") = 0 ]
    Show Custom Dialog [ "Captures" ; MBS("RegEx.CaptureCount"; $RegEx) & " captures" ]
End If
# free last
Set Variable [ $r ; Value: MBS("RegEx.Release"; $RegEx) ]

See also

Example Databases

This function is free to use.

Created 26th October 2014, last changed 26th April 2023


RSA.Verify - RegEx.Compile