verifyMatch not working with valid Regular Expression

Hi guys

I am trying to pass /sf$/ to verifyMatch but Katalon Studio/Groovy does not match the string “e3sf”.

A few weeks ago I tried something similar, this time trying to match start of string with /^Q/ but this didn’t work either.

Can you let me know if there’s a workaround for matching start/end of strings?


Bump – because I need resolution on this. Is it a bug? Am I doing something wrong?

Response please?

Hello I have the same problem. I tried a lot of things, even with the match all /.*/ did not work.

Both “matches regex” and “not matches regex” did not work.
even with the same regex, so at least one of them should work right? :wink:

Is there any documentation for matches regex in Katalon?
I’m trying to fix a object in the object repository

Thomas did you found any solution to this?

I gave up, Mattias. I stopped using the Katalon APIs and started asking the page in the AUT to evaluate it (i.e. I used JavaScript and jQuery).

Let me know if you want to see the code.


Ah ok, I understand.

We decided to use Katalon to make the automatic test to be more simple so that the testers could take more responsibility.

Well right now I already have a solution with this problem using WebdriverIO and Javascript.

I’m not sure if I can combine it with Katalon by converting it to a jar file, and use it that way.
I will investigate it a bit.

It is a little bit pity that Katalon is not Open source then I would just fix the bug by my self(it would probably be the fastest way for my problem).

Sorry about mixing your name Russ. (This is my first time posting here)

If i find a solution to this then I will reply to you how I solved it.

Take care

java.util.regex.Matcher ( implements 3 methods:

  • The matches method attempts to match the entire input sequence against the pattern.

  • The lookingAt method attempts to match the input sequence, starting at the beginning, against the pattern.

  • The find method scans the input sequence looking for the next subsequence that matches the pattern.

I suppose that Katalon’s verifyMatch uses the matches method which requires entire match. I tried the following test case:

def text = WebUI.getText(findTestObject('Page_CURA Healthcare Service/a_Make Appointment'))
WebUI.verifyMatch(text, 'Make Appointment', true)
WebUI.verifyMatch(text, '.*ment$', true)
WebUI.verifyNotMatch(text, 'ment$', true)
WebUI.verifyMatch(text, '^M.*', true)
WebUI.verifyNotMatch(text, '^M', true)
WebUI.verifyMatch(text, '.*', true)

All of the invocations of verifyMatch and verifyNotMatch succeeded as I expected.


You expect the find method, don’t you?


Excellent work, Kaz… “Best Answer” from me B)

Yes, “find” sounds like the right thing.

This really is a great example of “too much code” or “adding stuff to make it better” when all it actually does is confuse things (if not break them). Regex “works” just fine (even for me, and I’m no regex guru).

@Katalon Team:

To be clear, /^Q/ should match “Q123” -

1 Like

to Katalon Team

I believe Katalon uses java.util.regex.Pattern#compile(String string int flags) method:


I hope you describe in the document clearly how the regex string is compiled. I want to know how flags are set by the verifyMatch/verifyNotMatch source. To be specific, I want to know if MULTILINE flag is set ON or OFF because it affects how the $ sign works in Java regexp.


Hi, I can go in Katalon to use perhaps the global flag for Regex?
I do not see in the above list, no variant that would fit.

Now (Jan 2019) we can read the source code of Katalon builtin keywords on GitHub. You can see how the verifyMatch keyword is implemented. Please check the following portions:

  1. com.kms.katalon.core.keyword.BuitinKeywords; you want to find verifyMatch method here
  2. com.kms.katalon.core.keyword.builtin.VerifyMatchKeyword; you want to find verifyMatch method here
  3. com.kms.katalon.core.helper.KeywordHelper

In the KeywordHelper class, you find the match method:

    public static boolean match(String value1, String value2, boolean isRegex) {
		if (isRegex) {
			Pattern p = Pattern.compile(value2, Pattern.DOTALL);
			return p.matcher(value1).matches();
		} else {
			return (value1 != null && value2 != null && value1.equals(value2));

Reading this, you can see:

  1. The method calls java.util.regex.Matcher#matches() method to perform string matching. It does not call java.util.regex.Matcher#find() method.
  2. The method specifies a flag DOTALL only, which is defined as java.util.regex.Pattern.DOTALL. We can not specify the other flags (e.g, MULTILINE) at all.

great job, Kaz! Helped so much!