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 option | Number | Description |
Anchored | 16 | Force pattern anchoring |
Not BOL | 128 | Subject string is not the beginning of a line |
Not EOL | 256 | Subject string is not the end of a line |
Not Empty | 1024 | An empty string is not a valid match |
Partial | 32768 | Allow partial results. |
Newline CR | 1048576 | Set CR as the newline sequence |
Newline LF | 2097152 | Set LF as the newline sequence |
Newline CRLF | 3145728 | Set CRLF as the newline sequence |
Newline Any | 4194304 | Recognize any Unicode newline sequence |
Newline Any CRLF | 5242880 | Recognize CR, LF, and CRLF as newline sequences |
BSR Any CRLF | 8388608 | \R matches only CR, LF, or CRLF |
BSR Unicode | 16777216 | \R matches all Unicode line endings |
No start optimize | 67108864 | Disable match-time start optimizations |
Partial Hard | 134217728 | Return partial result if found before . |
Not Empty At Start | 268435456 | An empty string at the start of the subject is not a valid match |
UCP | 536870912 | Use 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
- IsError
- RegEx.CaptureCount
- RegEx.Compile
- RegEx.Free
- RegEx.NamedSubstring
- RegEx.Results
- RegEx.Study
- RegEx.Substring
Example Databases
RegEx.Compile - RegEx.FindMatches
Feedback: Report problem or ask question.
Links
MBS FileMaker Plugins