Regular Expression extractors should be used when you can't define an extractor using text delimiters. For example, you need to extract a GUID, but you did not know where it will appear in the response and its value.
The difference between the regular expression extractors and text delimited extractors is that instead of delimiters, you need to define the Regular Expression property (a). For example, if you need to extract value in a name/value pair combination and the name is some text followed by a number, then you can define a regular expression as follows:
The regular expression for GUID is:
If the regular expressions find more than one value, the Occurrence property (b) must be set appropriately. The search starts at the beginning of the response. By default, the first occurrence of the value will be used for the extractor. To use the second matching value, the Occurrence property should be changed from 1 to 2. To do so:
- Click Verify Extractor on the toolbar and compare the value in the Extractor Check window with the expected value.
- If an incorrect value is displayed, find the correct occurrence of the matching value by clicking Next/Previous Occurrence until you find the correct value.
- Click Set The Occurrence to properly adjust the Occurrence property.
For instruction on how to set other properties of the regular expression extractors, see the previous section, Text Delimited Extractors.
- No labels