Choose where you’d like to start

matches()

Overview

The matches() function takes string and regexString (regular expression) as arguments. It compares both the strings and returns True if both are found to be equal. Otherwise, it returns False.

Note: This function performs a case-sensitive comparison.

Return Type

  • Boolean

Syntax

<variable> = <string>.matches(<regexString>);

(OR)

<variable> = matches( <string>, <regexString> );
ParameterDescriptionData type
<variable>Variable which will contain the boolean value, true or false.BOOLEAN
<string>The string to be compared with the regular expressionTEXT
<regexString>The regular expression to be compared with the string.TEXT

Examples

IDValue = "ID004500F";
retValue = matches(IDValue, "[A-Z]{2}[0-9]{6}[A-Z]"); //returns true

num = "$345.78";
ret = matches(num, "\\$[0-9]+\\.[0-9]{2}"); //returns true

useremail = "jane2023@zylker.com";
format_check = matches(useremail,"[a-z 0-9]+\\@[a-z]+\\.[a-z]+"); //returns true

Get Started Now

Execute