how to pass default value if regex is not found

36 views
Skip to first unread message

Bharathi g

unread,
Jul 23, 2021, 1:34:43 PM7/23/21
to gat...@googlegroups.com
Hi,
I have a  regex(abc=(.*?)).findSaveas(cor_abc),
 if I run script for user1 it will find the value and saves in cor_abc,  for user2 it does not find the value. in this case how to send any default value for user2? 

Please advise

Bharathi g

unread,
Jul 23, 2021, 2:43:41 PM7/23/21
to gat...@googlegroups.com
Please help, Iam struck in middle of my project. 

How to find default value if the regex didnot find value?

Stéphane LANDELLE

unread,
Jul 24, 2021, 4:11:17 PM7/24/21
to gat...@googlegroups.com

regex(abc=(.*?)).transform {
  case None => SOME_DEFAULT_VALUE
  case some => some
}.saveas(cor_abc),

Indeed, it would be nice to have a built-in.
--

Stéphane Landelle

Chief Technical Officer

   

slan...@gatling.io
gatling.io
   
facebook twitter linkedin 


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gatling/CAFc0BffWQMSxhW-M48ARDtMAkDaWcob4rr7y9AHVsdU%2BOc%2BWwQ%40mail.gmail.com.

Stéphane LANDELLE

unread,
Jul 24, 2021, 4:13:29 PM7/24/21
to gat...@googlegroups.com
Implementing this built-in would be an easy contribution: https://github.com/gatling/gatling/issues/4114

--

Stéphane Landelle

Chief Technical Officer

   

slan...@gatling.io
gatling.io
   
facebook twitter linkedin 

Reply all
Reply to author
Forward
0 new messages