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.

Note: In CloudTest, when you are entering a Regular Expression for a Session Template, to Include/Exclude resources in a page, or for a PropSet in the Message Editor portion of the Clip Editor, you are entering a Java regular expression. Whereas, when you use regular expressions within a script (via the RegExp object or the /pattern/ notation), you are using a JavaScript regular expression. The two are not interchangeable, so you can’t copy expressions from one to the other.

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.

How to

  1. Optionally, check Use Regular Expression. Checking this box displays additional settings used to define a regular expression using both Leading Text and Trailing Text.
  2. Select text before or after a highlighted value. Highlights are in orange text.


  3. 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 __EVENTVALIDATION field was found in a scan, and then the Edit button for the method, SubString, was clicked. The value of this field is quite long.
  4. We used the horizontal scroll bar to locate where the highlighted string began.
  5. 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.
  6. 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).
  7. 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.
  8. 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).

What you should see