regexp with 2 groups

Hi,

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 => {
println(session)
})
but it prints compilation error - type mismatch;

By default, dot doesn’t match eol in Java regex, you have to enable DOTALL mode: http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html#DOTALL
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: http://www.myregextester.com/index.php

Cheers,

Stéphane

Many ways.
You can for example execute a lambda, such as .exec(session => {println(session); session})
https://github.com/excilys/gatling/wiki/Session#wiki-functions