0

I am trying to build a regex in jmeter while working in 1 script.

The response in the previous HTTP request looks like this:

<form accept-charset="UTF-8" action="/start" class="simple_form form-horizontal" id="new_challenger" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="JvOxXp/rtZ2dTOVzWqcbQENOHD7Qknws7CMy47L3RC0=" /></div><input id="challenger_step_id" name="challenger[step_id]" type="hidden" value="cEVWeUZHc3ZnSGR6dlhrSnRhd3ZLdz09LS1rOTlFS0crYitObmFMT0pOcXJ2MVZBPT0=--2baa3ff87227212cff656c4db1040680ff78ff3f" />
<input id="challenger_step_number" name="challenger[step_number]" type="hidden" value="1" />
<input class="btn btn-xl btn-default" name="commit" type="submit" value="Start" />
</form>

I need to extract the *_step_id i.e. challenger_step_id

cEVWeUZHc3ZnSGR6dlhrSnRhd3ZLdz09LS1rOTlFS0crYitObmFMT0pOcXJ2MVZBPT0=--2baa3ff87227212cff656c4db1040680ff78ff3f


I tried the below regex but its not giving me any result when I test in regexp tester in the Results Tree View.

Regex used:

challenger[step_id]" type="hidden" value=(.+?) /><input id. 

Is it happening because of the "--" characters or something else?

Need some help.

Thanks, Subhojit

Ωmega
  • 42,614
  • 34
  • 134
  • 203
Subhojit
  • 1
  • 1

1 Answers1

0

It is a bad idea to parse html using regex.

But if for whatever reason you have to use regex in your task, use a pattern like this:

<input[^>]+id="([^"]+)_step_id"[^>]+value="([^"]*)"[^>]*>

You may need to escape (using \) some special characters, depends on how you use the regex pattern in your source code.

Ωmega
  • 42,614
  • 34
  • 134
  • 203