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.Match

Matches a text against to a pattern.

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

MBS( "RegEx.Match"; Pattern; Text; CompilerOptions; ExecuteOptions )

Parameters

Parameter Description Example value
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.

OptionNumberDescription
Caseless1Do caseless matching
CaseSensitive0Do case sensitive matching
Multiline2^ and $ match newlines within data
SingleLine0^ and $ do not match newlines within data
DotAll4. matches anything including NL
Extended8Ignore white space and # comments
Anchored16Force pattern anchoring
DollarEndOnly32$ not to match newline at end
NotBOL128Subject string is not the beginning of a line
NotEOL256Subject string is not the end of a line
Ungreedy512Invert greediness of quantifiers
Greedy0Be greedy.
NotEmpty1024An empty string is not a valid match
Empty0An empty string is a valid match
AutoCapture0Enable numbered capturing parentheses
NoAutoCapture4096Disable numbered capturing parentheses (named ones available)
AutoCallout16384Compile automatic callouts
NoAutoCallout0Don’t compile automatic callouts
Partial32768Allow partial results.
FirstLine262144Force matching to be before newline
DupNames524288Allow duplicate names for subpatterns
NewlineCR1048576Set CR as the newline sequence
NewlineLF2097152Set LF as the newline sequence
NewlineCRLF3145728Set CRLF as the newline sequence
NewlineAny4194304Recognize any Unicode newline sequence
NewlineAnyCRLF5242880Recognize CR, LF, and CRLF as newline sequences
BSRAnyCRLF8388608\R matches only CR, LF, or CRLF
BSRUnicode16777216\R matches all Unicode line endings
JavaScriptCompatible33554432JavaScript compatibility
NoStartOptimize67108864Disable match-time start optimizations
PartialHard134217728Return partial result if found before .
NotEmptyAtStart268435456An 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

Match Hello with pattern:

MBS( "RegEx.Match"; "H(.*)o"; "Hello")

Match case less:

MBS( "RegEx.Match"; "H(.*)o"; "hello"; 1)

See also

Example Databases


RegEx.List   -   RegEx.MatchList

Feedback: Report problem or ask question.




Links
MBS Xojo tutorial videos