RegExMatch Function

The RegExMatch function uses Regular Expression (RegEx) to verify if the string value matches a specific pattern. RegExMatch has a number of use cases such as matching phone number formats, routing numbers, or any string that needs to follow a specific format. In this example, we will use email address.



1 = String value to use in search (can be a variable)
2 = Regular Expression to use in search in conjunction with string value in 1
3 = Ordinal of group to return
4 = Repeating string parameter of regular expression options to use




set @emailAddress = “”
set @emailRegEx = “^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+\.[a-zA-Z]{2,})$”

set @emailProviderTLD = RegExMatch(@emailAddress, @emailRegEx, 2) 





When using RegEx and determining the pattern or format to use, the use of parenthesis identifies the different parts of the string that need to be isolated. In the example RegEx above: ^([a-zA-Z0-9_-.]+)@([a-zA-Z0-9_-.]+.[a-zA-Z]{2,})$ — the part of the email address before the @ symbol is isolated from the domain and TLD of the email. This splits the string into two groups.

The goal of this use case was to determine the domain that is used in the email address (everything after the @ symbol). To do this, we isolate the second group using the RegExMatch function with everything that comes after the @ symbol.

The output of that value is as the RegExMatch function is returning the value of the string in the second group.

This is a simple example of RegExMatch and there are an unlimited number of possibilities that RegExMatch can be used for.

Leave a Reply

Your email address will not be published. Required fields are marked *