---
title: "Boundary Extractor"
description: "Configure the JMeter Boundary Extractor post-processors: properties, defaults, and practical usage notes for building reliable load tests."
url: https://docs.jmeter.ai/components/boundary-extractor/
lastUpdated: 2026-10-01
source: docs.jmeter.ai
---

# Boundary Extractor

*Part of the **Post-Processors** category. Also documented in context in the [full Component Reference](/user-manual/component-reference/#boundary-extractor).*

![Boundary Extractor](/images/screenshots/extractor/boundary_extractor.png)

Allows the user to extract values from a server response using left and right boundaries.  As a post-processor,
this element will execute after each Sample request in its scope, testing the boundaries, extracting the requested values,
generate the template string, and store the result into the given variable name.

| Name | Required | Description |
| --- | --- | --- |
| Name | No | Descriptive name for this element that is shown in the tree. |
| Apply to: | Yes | This is for use with samplers that can generate sub-samples,         e.g. HTTP Sampler with embedded resources, Mail Reader or samples generated by the Transaction Controller.          - `Main sample only` - only applies to the main sample - `Sub-samples only` - only applies to the sub-samples - `Main sample and sub-samples` - applies to both. - `JMeter Variable Name to use` - assertion is to be applied to the contents of the named variable         Matching is applied to all qualifying samples in turn.         For example if there is a main sample and 3 sub-samples, each of which contains a single match test,         (i.e. 4 matches in total).         For match number = `3`, Sub-samples only, the extractor will match the 3rd sub-sample.         For match number = `3`, Main sample and sub-samples, the extractor will match the 2nd sub-sample (1st match is main sample).         For match number = `0` or negative, all qualifying samples will be processed.         For match number > `0`, matching will stop as soon as enough matches have been found. |
| Field to check | Yes | The following fields can be checked:          - `Body` - the body of the response, e.g. the content of a web-page (excluding headers) - `Body (unescaped)` - the body of the response, with all Html escape codes replaced.         Note that Html escapes are processed without regard to context, so some incorrect substitutions         may be made.          :::note Note that this option highly impacts performances, so use it only when absolutely necessary and be aware of its impacts ::: - `Body as a Document` - the extract text from various type of documents via Apache Tika (see [View Results Tree](/components/view-results-tree/) Document view section).          :::note Note that the Body as a Document option can impact performances, so ensure it is OK for your test ::: - `Request Headers` - may not be present for non-HTTP samples - `Response Headers` - may not be present for non-HTTP samples - `URL` - `Response Code` - e.g. `200` - `Response Message` - e.g. `OK`         Headers can be useful for HTTP samples; it may not be present for other sample types. |
| Name of created variable | Yes | The name of the JMeter variable in which to store the result.  Also note that each group is stored as `[refname]_g#`, where `[refname]` is the string you entered as the reference name, and `#` is the group number, where group `0` is the entire match, group `1` is the match from the first set of parentheses, etc. |
| Left Boundary | No | Left boundary of value to find |
| Right Boundary | No | Right boundary of value to find |
| Match No. (0 for Random) | Yes | Indicates which match to use.  The boundaries may match multiple times.              - Use a value of zero to indicate JMeter should choose a match at random. - A positive number N means to select the nth match. - Negative numbers are used in conjunction with the [ForEach Controller](/components/foreach-controller/) - see below. |
| Default Value | No, but recommended | If the boundaries do not match, then the reference variable will be set to the default value.         This is particularly useful for debugging tests. If no default is provided, then it is difficult to tell         whether the boundaries did not match, or maybe the wrong variable         is being used.                  However, if you have several test elements that set the same variable,         you may wish to leave the variable unchanged if the expression does not match.         In this case, remove the default value once debugging is complete. |

If the match number is set to a non-negative number, and a match occurs, the variables are set as follows:

- `refName` - the value of the extraction

If no match occurs, then the `refName` variable is set to the default (unless this is absent).

If the match number is set to a negative number, then all the possible matches in the sampler data are processed.
The variables are set as follows:
- `refName_matchNr` - the number of matches found; could be `0`
- `refName__n_`, where `n` = `1`, `2`, `3` etc. - the strings as generated by the template
- `refName__n__g_m_`, where `m`=`0`, `1`, `2` - the groups for match `n`
- `refName` - always set to the default value

Note that the `refName` variable is always set to the default value in this case,
and the associated group variables are not set.

> **Note**
> If both left and right boundary are null, the whole data selected in scope is returned

## Related

- [Correlation & Dynamic Values](/topics/correlation-dynamic-values/)
- [Regex Extractor Builder](/tools/regex-tester/)
- [Full Component Reference](/user-manual/component-reference/)
- [Functions and Variables](/user-manual/functions/)
