This topic describes the syntax and usage of the matches function in Zoho Creator .


The matches function checks whether the first argument string matches the regular expression given as second argument.


<string>.matches(<regular expression>)


matches(str1 , str2)

// this format is supported only in the free flow scripting mode of Script builder.

The matches function syntax has the following arguments.

string - Required. The main string which you what to match with the regular expression

regular expression - Required. The regular expression.

Return Value

Returns true if first argument string matches the given regular expression. Returns false otherwise.


phone = "(123) 456 7890";

if(phone.matches("^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$") == false)


Info "Please enter a valid Phone format";


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

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: