RegexMatch$() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Matches the given RegEx pattern with the input string and returns TRUE if the given expression matches the whole string. Otherwise, the function returns FALSE. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

RegExMatch$(input_string, expression_string [, case_insensitive ] )

input_string (String): A string with the target sequence (the subject) against which the RegEx expression is matched.

expression_string (String) : The RegEx pattern to match the string to.

case_insensitive (Logical) : Character matching should be performed without regard to case.(This parameter is Optional) (default value is TRUE)

.

Return Value

Logical

Description

Use the RegexMatch$() function to match the given RegEx pattern with the input string. This function returns TRUE if the given expression matches the whole string. Otherwise, the function returns FALSE.

case_insensitive is optional and defaults to TRUE.

Note: This function uses ECMAScript grammar for RegEx match. https://www.cplusplus.com/reference/RegEx/ECMAScript/
Note: Positive/negative lookbehind regex expression are not supported.

Examples

print RegExMatch$("foo.txt", "[a-z]+\.txt")
//returns T
print RegExMatch$("foo.txt", "[a-z]+\.TXT", FALSE)
//returns F
Print RegExMatch$("xxxabc123xyz","abc.*xyz")
//returns F ‘Use RegExSearch$ to get substring match.