Creating a Regular Expression Using the SubString Parser
The SubString Parser provides the unique ability to build regular expressions based on selected text from the message response text shown above. Use the following steps to create a regular expression.
The Regular Expression section includes the following fields:
- Expression – This field displays the regular expression that is being built here.
- Insert Non-Fixed – Highlight and click Insert Non-Fixed for all non-fixed characters in both Leading Text and Trailing Text.
- Optionally, check Use Regular Expression. Checking this box displays additional settings used to define a regular expression using both Leading Text and Trailing Text.
- Select text before or after a highlighted value. Highlights are in orange text.
- Click OK to accept your settings or Cancel to abandon the SubString changes. Clicking OK here automatically checks the edited row for inclusion in this session template package. In the example on the right, an
__EVENTVALIDATIONfield was found in a scan, and then the Edit button for the method, SubString, was clicked. The value of this field is quite long.
- We used the horizontal scroll bar to locate where the highlighted string began.
- Then, as above, we selected text before the orange text, and then clicked Insert Selected for the Leading Text field. The Leading Text field was populated.
- Then we did the same for the text after the orange text and then clicked Insert Selected for the Trailing Text field.TIP: In cases where variable, or non fixed, text is part of a text string that has been inserted into either the Leading Text or Trailing Text fields, that text can be replaced in the expression below by first selecting it, and then clicking Insert Non-Fixed to the right of the Expression field.For example, if the text string,
value(on the right), is “non-fixed” (e.g. changes from session to session), select it and then click the Insert Non-Fixed button.After Insert Non-Fixed was clicked, the Expression field string,
value, reflected this change (on the right).
- After we had a successful result, we checked Use Regular Expression to reveal the regular expression equivalent for the result.Note: If Use Regular Expression is checked at the time the Insert buttons are used, the Expression field is populated at that time.
- Once the expression below has been built, test it by clicking the Test button. If the expression is successful, the text between trailing and leading selections above is captured (e.g. the captured text is the same as the orange highlighted text from above) in the Test Result field (the text is not highlighted a second time).