Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
RegEx.Match
Matches a text against to a pattern.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
RegEx | 4.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "RegEx.Match"; Pattern; Text; CompilerOptions; ExecuteOptions ) More
Parameters
Parameter | Description | Example |
---|---|---|
Pattern | The pattern to use. | "H(.*)" |
Text | The text to search. | "Hello" |
CompilerOptions | A number for the options to use. e.g. 1 for case insensitive or 512 for ungreedy. Can be given as text or number. |
512+1 |
ExecuteOptions | The options for executing. Can be given as text or number. |
0 |
Result
Returns 0, 1 or error.
Description
Matches a text against to a pattern.This compiles the pattern, executes it and looks if we have a match or not.
Returns 1 if matches and 0 if not.
Option | Number | Description |
Caseless | 1 | Do caseless matching |
CaseSensitive | 0 | Do case sensitive matching |
Multiline | 2 | ^ and $ match newlines within data |
SingleLine | 0 | ^ and $ do not match newlines within data |
DotAll | 4 | . matches anything including NL |
Extended | 8 | Ignore white space and # comments |
Anchored | 16 | Force pattern anchoring |
DollarEndOnly | 32 | $ not to match newline at end |
NotBOL | 128 | Subject string is not the beginning of a line |
NotEOL | 256 | Subject string is not the end of a line |
Ungreedy | 512 | Invert greediness of quantifiers |
Greedy | 0 | Be greedy. |
NotEmpty | 1024 | An empty string is not a valid match |
Empty | 0 | An empty string is a valid match |
AutoCapture | 0 | Enable numbered capturing parentheses |
NoAutoCapture | 4096 | Disable numbered capturing parentheses (named ones available) |
AutoCallout | 16384 | Compile automatic callouts |
NoAutoCallout | 0 | Don’t compile automatic callouts |
Partial | 32768 | Allow partial results. |
FirstLine | 262144 | Force matching to be before newline |
DupNames | 524288 | Allow duplicate names for subpatterns |
NewlineCR | 1048576 | Set CR as the newline sequence |
NewlineLF | 2097152 | Set LF as the newline sequence |
NewlineCRLF | 3145728 | Set CRLF as the newline sequence |
NewlineAny | 4194304 | Recognize any Unicode newline sequence |
NewlineAnyCRLF | 5242880 | Recognize CR, LF, and CRLF as newline sequences |
BSRAnyCRLF | 8388608 | \R matches only CR, LF, or CRLF |
BSRUnicode | 16777216 | \R matches all Unicode line endings |
JavaScriptCompatible | 33554432 | JavaScript compatibility |
NoStartOptimize | 67108864 | Disable match-time start optimizations |
PartialHard | 134217728 | Return partial result if found before . |
NotEmptyAtStart | 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
Match Hello with pattern:
MBS( "RegEx.Match"; "H(.*)o"; "Hello")
Match case less:
MBS( "RegEx.Match"; "H(.*)o"; "hello"; "caseless")
Match multiline:
MBS( "RegEx.Match"; "^Hello$"; "Test¶Hello¶World"; "MultiLine NewLineAny CaseLess"; "NewLineAny" )
See also
Example Databases
Blog Entries
- MBS Plugin Advent calendar: 19 - RegEx
- Regular Expressions in FileMaker
- MBS FileMaker Plugin, version 5.3pr5
This function checks for a license.
Created 26th October 2014, last changed 17th March 2023