CompilerErrorPos Property

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


Use the RegExpr.CompilerErrorPos property to find the position where the compilation stopped. If the error occurred verify the syntax of the regular expression.



Read-Only Property Integer
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 integer value specifying the error position.

This property returns 0 if the regular expression compiled successfully.


The following example demonstrates how to use the RegExpr.Compile method to force expression conversion and to get conversion errors that occur during compilation.


procedure CompileSample;
  MyRegExp: OleVariant;
  Mes: string;
  Err, Pos: integer;

    // Specifies a regular expression
    MyRegExp.Expression := '[]';
    // Forces expression conversion
    // Performs operations over text
    // If a compilation error occurs…
    // Obtains the code of the occurred error
    Err := MyRegExp.LastError;
    // Obtains the description of the occurred error
    Mes := MyRegExp.ErrorMsg[Err];
    // Obtains the position, in the regular expression, where the error occurred
    Pos := MyRegExp.CompilerErrorPos;
    // Posts information on the error to the test log
    Log.Error('Error: ' + aqConvert.IntToStr(Err) + ' ' + Mes + ' (pos ' + aqConvert.IntToStr(Pos) + ')');

See Also

Using Regular Expressions in Scripts
Using Regular Expressions in Scripts
Expression Property
Compile Method
ErrorMsg Property
LastError Property

Highlight search results