Struggling to find a way to write regex captured values to a file

Hi All,

I have two lists captured from previous regex. My requirement is to loop through these lists and write the values to a file. I’m trying to do it with the below code.

.check(regex(",“accountNumber”:"(.+?)",“sortCode”").findAll.saveAs(“accountNumber”))
.check(regex(",“iban”:"(.+?)",“accountNumber”").findAll.saveAs(“iban”))

.foreach("${accountNumber}", “accountNumber_id”, “counter”)
{
exec(http(“XXXXXXX”)

.post(“YYYYYYYYY”)

.exec(session => { CreateFeederFile.createFPSFeeder("${accountNumber_id}", “${iban(counter)}”)
session

})

}

But all I can see in the file is as below.

${accountNumber_id},${iban(counter)}

The values are not being replaced.

I can see my code is not working but not sure how I can achieve my requirement.

Please can you help.

Regards,
Prash.

Hi All,

Slightly changed the logic as below.

.foreach("${iban}", “iban_id”, “counter”)

.exec(session =>session.set(“accountNumber_id”, session(“iban_id”).as[String].slice(13,8)))

But not is getting saved to accountNumber_id.

Please can you guide me.

Kind Regards,
Prash.

Guys,

I’ve tried every thing I can think of.

val iban = session(“iban_id”).as[String]

println( “iban_id as var is>>>>>>>>>>> :” + iban.toString.slice(3,3) )

println( “iban_id as substring is>>>>>>>>>>> :” + iban.substring(3,3) )

nothing is working.

Please can you help.

Sorted, thanks !!!