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

RegEx.Execute

Executes a statement.

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

MBS( "RegEx.Execute"; RegExRef; Text; ExecuteOptions { ; Offset } )

Parameters

Parameter Description Example value
RegExRef The reference number for the regular expression returned from RegEx.Compile. $regex
Text The text to search. "Hello"
ExecuteOptions The options for executing.
Can be given as text or number.
0
Offset Optional
Optional the offset in the text to start. Can be in range from 0 to length(text).
0

Result

Returns result or error.

Description

Executes a statement.
You need to compile pattern before with RegEx.Compile function.
Returns the number of results.
Use RegEx.Results function to get list of results.

Execute optionNumberDescription
Anchored16Force pattern anchoring
Not BOL128Subject string is not the beginning of a line
Not EOL256Subject string is not the end of a line
Not Empty1024An empty string is not a valid match
Partial32768Allow partial results.
Newline CR1048576Set CR as the newline sequence
Newline LF2097152Set LF as the newline sequence
Newline CRLF3145728Set CRLF as the newline sequence
Newline Any4194304Recognize any Unicode newline sequence
Newline Any CRLF5242880Recognize CR, LF, and CRLF as newline sequences
BSR Any CRLF8388608\R matches only CR, LF, or CRLF
BSR Unicode16777216\R matches all Unicode line endings
No start optimize67108864Disable match-time start optimizations
Partial Hard134217728Return partial result if found before .
Not Empty At Start268435456An empty string at the start of the subject is not a valid match
UCP536870912Use Unicode properties for \d, \w, etc.

Please pass sum of the numbers to select options.

Examples

Run query and show substrings:

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) ]
    Show Custom Dialog [ "Substrings" ; MBS("RegEx.Substring"; $RegEx) & ¶ &
MBS("RegEx.Substring"; $RegEx; 1) & ¶ &
MBS("RegEx.Substring"; $RegEx; 2) & ¶ &
MBS("RegEx.Substring"; $RegEx; 3)]
End If
# free last
Set Variable [ $r ; Value: MBS("RegEx.Free"; $RegEx) ]

See also

Example Databases


RegEx.Compile   -   RegEx.FindMatches

Feedback: Report problem or ask question.




Links
MBS FileMaker Plugins