RegExpr Object

Applies to TestComplete 15.64, last modified on June 12, 2024


The RegExpr object allows using regular expressions in DelphiScript. This way, you can perform search and replace operations over the text fragments that match the specified regular expression pattern. Also, you can use regular expressions to validate user input data.

To get the object in your tests, use the HISUtils.RegExpr property.

Please read the Using Regular Expressions in Scripts topic to learn how to compose regular expressions.


The RegExpr object is available only if the HISUtils plugin is enabled.

This plugin is installed and enabled by default during the TestComplete installation. You can check the plugin status in the File > Install Extensions dialog in TestComplete. You can find the plugin in the Common group.



The following code obtains the text that matches a regular expression and posts the text to the test log.


procedure Sample;
  MyRegExpr : OleVariant;
  MyRegExpr := HISUtils.RegExpr;
  MyRegExpr.InputString := 'Please e-mail us at [email protected] or [email protected]';
  MyRegExpr.Expression := '[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}';
  // Posts the first matching segment of the text to the test log

See Also

HISUtils Object
Installing Extensions
Using Regular Expressions in Scripts
Using Regular Expressions in Scripts

Highlight search results