Purpose
This function gets the index of the first sub-string matching the given RegEx pattern with the input string. This function returns a non-negative value if the input string contains a sub-string matching the RegEx pattern. Otherwise, this function returns -1. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
RegExSearch$(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
Integer
Description
Use the RegexSearch$() function to
get the index of the first substring matching given RegEx pattern with the input string. This function returns a non-negative value if the input string contains a substring matching the RegEx pattern. Otherwise, this function returns -1.
case_insensitive is optional and defaults to TRUE.
Examples
Print RegExSearch$("xxxabc123xyz","abc.*xyz")
//returns 4
Print RegExSearch$("abc123123", "123$")
//returns 7
Print RegExSearch$("abc123123", "123")
//returns 4
Print RegExSearch$("abc123123", "2123")
//returns -1