regexp with 2 groups


First of all I’m new to Gatling 2 so no judgment!
I’m trying to migrate SilkPerformer load scripts to Gattling but faced issue with regexp check.

We have following piece of HTML

  Procedure: Startup - Hyperion Essbase

Need to get just step id that is in this case 37198.
Built following check
.check(regex("""<tr id=“step_(\d+)” class=“procedure.*Startup - Hyperion Essbase”"").findAll.saveAs(""“PROCEDURE”""))

But it doesn’t return anything (no PROCEDURE in session).
If I remove second regex mask with following text it founds id but it is just first occurrence not particular that I need.
The question is how can I substitute all text between class="procedure and Startup - Hyperion Essbase to get this regex return me necessary id.

And the second question how can I output session in Gatling 2
I’ve tried
.exec(session => {
but it prints compilation error - type mismatch;

By default, dot doesn’t match eol in Java regex, you have to enable DOTALL mode:
The easiest way is to prefix your regex with (?s):
(?s)<tr id=“step_(\d+)” class="procedure.*Startup - Hyperion Essbase

BTW, this is not a Gatling question, but a general Java one. There’s plenty of online regex testers, such as this one:



Many ways.
You can for example execute a lambda, such as .exec(session => {println(session); session})