Applies to TestComplete 14.40, last modified on April 01, 2020

Description

Use the RegExpr.InputString to assign a new or to get current input text.

Declaration

RegExprObj.InputString

Read-Write Property String
RegExprObj An expression, variable or parameter that specifies a reference to a RegExpr object

Applies To

The property is applied to the following object:

Property Value

The string specifying the input text. The text could contain line breaks and depending on the multi-line mode modifier it could be interpreted as one or several text lines.

Remarks

The input text can be defined explicitly by assigning a value to the InputString property or implicitly via the RegExpr.Exec method: a value of the InputStr parameter is automatically assigned to the InputString property.

Any assignment to the InputString property makes the values of the Match, MatchLen and MatchPos properties undefined.

Example

The following example demonstrates how to specify input text using the RegExpr.InputString property.

DelphiScript

procedure Sample;
var
  MyRegExpr : OleVariant;
begin
  MyRegExpr := HISUtils.RegExpr;
  // Initializes the InputString property
  MyRegExpr.InputString := 'Please e-mail us at support@mycompany.com or sales@mycompany.com';
  // Initializes the Expression property
  MyRegExpr.Expression := '[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}';
  MyRegExpr.ExecPos;
  // Posts the first matching text to the test log
  Log.Message(MyRegExpr.Match[0]);
end;

See Also

Regular Expressions Syntax
Using Regular Expressions in Scripts
Exec Method
ModifierStr Property
Match Property
MatchLen Property
MatchPos Property

Highlight search results