How to match all numbers on specific html element and save as an attribute in Gatling

24 views Asked by At

I am trying to understand how regex and syntax work in Gatling. but having a hard time understanding it. In my response body, I have <a href="display.php?id=195760&amp;userId=416422" tabindex="12"> and I want to save the id using regex in Gatling. so far I have tried this, but it does not work. I have anyone have an input to it.

regex("""<a href='display.php?id=(\d+)""").saveAs("testId")

right now I am getting error

regex(<a href='display.php?id=(\d+)).find.exists, found nothing

I expected that the regex match the numers inside a tag and save it testId as atribute in Gatling

1

There are 1 answers

0
Stéphane LANDELLE On

You're using a single quote in your regex while your actual text contains a double quote. How could it possibly match?