I could reproduce your case on my side.
Yes, it is a bug in Katalon Studio. It is a well-known fossil bug going back 〜8 years.
When you switch from Script to Manual, the Groovy source code is compiled into an Abstract Syntax Tree. When you switch from Manual to Script, Katalon transforms the Abstract Syntax Tree (also known as AST) into a Groovy source code. Unfortunately Katalon Studio has some problems about AST-to-Source transformation. Therefore
- the Groovy source you wrote by your hand in the text editor (Script mode)
- the Groovy source generated by Katalon Studio when you switch from Manual mode to Script mode
these two codes can not be identical completely.
@jithin found that "${matcher.group(0)}" was changed to "$matcher.group(0)" by Katalon. This is an instance of defect. I think it will be very difficult to fix these problems.
In short, the Manual mode and the Script mode — these are not interchangeable. This fact contradicts the user’s expectations. The official doc never explains this fact.
How to prevent this mess?
If you live with Script mode, then you should never switch to Manual mode. That act corrupts you.
If you live with Manual mode, that’s fine. But you should never cheat on it.
Switching between two modes to and fro confuses you. You should stay in one.
I don’t think Katalon is going to fix it, ever.
He recently wrote
http://forum.katalon.com/t/sometimes-you-need-to-treat-bugs-a-little-differently/142082
It appears that someone at Katalon never returned from their journey to find the answer to this issue. @devalex88?
Personally, I don’t care this bug because I would never touch the Manual mode.