The Create Data Replacer wizard helps you create data replacers. Data replacers are regular expressions that LoadComplete applies to requests to find data in them and replace it with variable values.
To call the wizard, right-click in the Data Replacers tabbed page of the request and then click Create data replacer with wizard.
Note: | Creation of data replacers for the entire scenario with the wizard is not supported. |
Specifying the Data to Replace
The wizard allows creating regular expressions for the most frequent use cases visually. The following options are available:
-
Retrieve text - Choose this option to replace a specific text fragment in a request. On the next page of the wizard, you select the text you want to replace.
The data replacer will extract the selected text from the request and replace it with a variable value.
-
Get text between two values - Choose this option to replace the data located between two arbitrary text fragments in the request. On the next pages of the wizard, you select those fragments in the request contents.
-
Get an input field value - This option cannot be applied to data replacers.
-
Get text with a regular expression - Choose this option to replace arbitrary data in a request by using a custom regular expression. On the next page of the wizard, you create the desired regular expression (either manually or by selecting predefined patterns from the popup menu) and verify that it matches the expected data.
-
Use text of response header - Choose this option to replace data in the request header. Otherwise, the created data replacer will replace data in the request body.
Specifying the Regular Expression
On the Specify the regular expression to use page of the wizard, you can view the regular expression the wizard has created, or create a custom regular expression.
To simplify creation and editing of regular expressions, the wizard provides a list of the most common regular expression patterns. To add a pattern to your regular expression, click the button and select the desired pattern from the popup menu. For detailed information on the supported regular expressions, see Regular Expressions Syntax.
The page shows the request contents and highlights the text that matches the regular expression. If several text fragments match the regular expression, select the match you want to replace.
Tweaking the Regular Expression
On the last page of the wizard, you can view the data that the created regular expression will replace.
If the regular expression matches several text fragments, you can specify the index of the fragment you want to replace.
You can also select a conversion rule for the created data replacer. The data replacer will apply the rule to the variable value before inserting it into the request.
Finishing Work With the Wizard
Click Finish to complete the data replacer creation and close the wizard. To close the wizard without creating the data replacer, click Cancel.
LoadComplete will add the created data replacer to the replacers list on the Data Replacers tab.
In the Variable column of the Data Replacers tab, specify the variable with which you want to replace the specified data in the request.
See Also
Inserting Variables Into Arbitrary Parts of Requests
Data Correlation
Regular Expressions Syntax