Regexp Variable Extractor

Regular Expression Extractors lets you extract values from HTTP responses, using regular expressions.

Extracting variables from HTTP response helps you make your Virtual User have a dynamic behavior. Extracted variables can be injected in Logic Actions or HTTP Request Actions.

Regexp Extractor

The first line displays the extracted variable name. This field is mandatory if you want to inject what you extract. The second line contains tab headers to access:

  • Simple Configuration, to easily generate a regular expression,
  • Advanced Configuration, for more specific needs,
  • Check, to validate the result of your Regexp against a recorded HTTP response.


The response selector, on the right, lets you choose which HTTP response is used for configuring and checking the Regexp Action. So if neither recorded responses nor Validate VU responses are available, you have to configure the Regexp Action blindly.

Simple configuration

The Regexp Action is used to extract values from both HTTP response headers and body.

Body extraction

To extract a value from a response body :

  1. Select the Configuration tab,
  2. Select Body on the right toggle buttons,
  3. Browse the response body, and select the text you want to extract,
  4. Blue and green selections appear on the sides of the selected text, it displays the left and right text delimiters,
  5. Adjust left and right offsets to stretch or shrink the text delimiters,
  6. The generated regexp is shown on the bottom of the tab, it has the form 'Any text between left delimiter and right delimiter' and can be edited in Advanced mode.


You can search for Strings or Regular Expressions (JavaScript format) inside the response body:

  1. Click on the body text area,
  2. Type CTRL + F (or CMD + F on Mac), a dialog appears on top of the area,
  3. Type the text to search or a regex,
  4. Press Enter to start searching for the first term occurrence
  5. Press CTRL + G (or CMD + G on Mac) to find the next occurrence, or SHIFT + CTRL + G (or SHIFT + CMD + G on Mac) to find the previous one.

Header extraction

To extract a value from the headers of an HTTP response :

  1. Select the Configuration tab,
  2. Select Headers on the right toggle buttons,
  3. Browse the response headers, and select the one whose value you want to extract,
  4. The generated regexp is shown on the bottom of the tab and can be edited in advanced mode.

Advanced configuration

You may start by using the simple mode, and then switch to advanced to customise the generated regexp.

The Advanced tab may fulfil more complex requirements.

The following procedure explains how to configure a Regexp Action:

  1. Select the Advanced tab,
  2. Select Headers or Body on the right toggle buttons, depending on where your want to apply the regular expression,
  3. Fill in the Regexp field using ORO matcher syntax,
  4. Type the template to extract,
  5. Select the match number. The regexp may match multiple values in the HTTP response, in such case you can select which value to extract,
  6. Fill in the default value (if the regexp does not match the HTTP response).


The response panel only displays the content of the HTTP response Body / Headers. To select the text to extract, use the simple Configuration tab.


The template format:

  • $0$ extracts the whole regexp,
  • The default $1$ value, to extract the first group value (a group is what is between a set of parenthesis). E.g. for the regexp categoryId=(.+?)" the template $1$ extracts the string matched by (.+?),
  • In case you use multiple groups in the regexp, $n$ extracts the nth group value.
  • You can also include arbitrary text in the template. E.g. 'cat$1$' to generate the string 'cat' followed by the content of the first group.

The match number format:

  • Random, to select any of the values.
  • Select nth, to select a particular value.
  • All, to select all values. If you select this option, the generated variable can be used in the ForEach Action.

Check regexp result

To check the result of a Regexp action just click on the Check tab.

The check process is automatically launched when this tab is opened. It can also be manually started using the Refresh button.

A table contains the extracted values :

Column name Description
Extracted variable name The name of the extracted variable. A single Regexp Action can lead to multiple extracted variables. More information below.
Extracted variable value The value of the extracted variable.


Multiple variables can be generated by a single Regexp Action.

E.g. for an extractor named categoryId with the regexp value categoryId=(.+?)", a Select nth match number and a template $1$:

  • categoryId : the base variable, it contains the extracted value (or the default value), e.g. FISH
  • categoryId_g : the count of groups used in the regexp,
  • categoryId_g0 : the whole extraction, delimiters included, e.g. categoryId=FISH",
  • categoryId_gn : where n=0,1,2 - the groups values.

With an All match number, multiple variables are generated to be used in the ForEach Action :

  • categoryId : always has the default value,
  • categoryId_matchNr : the number of values extracted, e.g. 5,
  • categoryId_N : the Nth value extracted,
  • and for each categoryId_N, the categoryId_N_g, categoryId_N_g0 and categoryId_N_gn generated variables.


The error message 'Variable name must not be null to run the test.' may be displayed if the Regexp Action has no name. An extracted variable without name cannot be used for value injection.