Differences between revisions 2 and 3
Revision 2 as of 2005-07-13 13:54:22
Size: 2622
Comment:
Revision 3 as of 2009-09-20 21:56:47
Size: 2627
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
 http://jakarta.apache.org/jmeter/images/screenshots/regex_extractor.png  {{http://jakarta.apache.org/jmeter/images/screenshots/regex_extractor.png}}
Line 14: Line 14:
|| '''Match No.''' || Indicates which match to use. The regular expression may match multiple times. [[BR]][[BR]] * Use a value of zero to indicate JMeter should choose a match at random.[[BR]] * A positive number N means to select the nth match.[[BR]] * Negative numbers are used in conjunction with the [:/../ForEachController:ForEach controller] - see below. || Yes || || '''Match No.''' || Indicates which match to use. The regular expression may match multiple times. <<BR>><<BR>> * Use a value of zero to indicate JMeter should choose a match at random.<<BR>> * A positive number N means to select the nth match.<<BR>> * Negative numbers are used in conjunction with the [[/../ForEachController|ForEach controller]] - see below. || Yes ||

Regular Expression Extractor

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

Control Panel

  • http://jakarta.apache.org/jmeter/images/screenshots/regex_extractor.png

Parameters

Attribute

Description

Required

Name

Descriptive name for this element that is shown in the tree.

No

Reference Name

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.

Yes

Regular Expression

The regular expression used to parse the response data. This must contain at least one set of parentheses "()" to capture a portion of the string, unless using the group $0$.

Yes

Template

The template used to create a string from the matches found. This is an arbitrary string with special elements to refer to groups within the regular expression. The syntax to refer to a group is: '$1$' to refer to group 1, '$2$' to refer to group 2, etc. $0$ refers to whatever the entire expression matches.

Yes

Match No.

Indicates which match to use. The regular expression 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 - see below.

Yes

Default Value

If no matches are found, the default value is stored in the variable.

No

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_gm, where m=0,1,2 - the groups for match n
  • refName - always set to the actual template value if a match is found, otherwise, the default value.
  • refName_gn - not set

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

UserManual/Reference/RegularExpressionExtractor (last edited 2009-09-20 21:56:47 by localhost)