SpaceChars Property

Applies to TestComplete 14.70, last modified on April 22, 2021

Description

Use RegExpr.SpaceChars to specify which characters will be treated as \s.

The default value is space (\s), tab (\t), newline (\n), line feed (\r) and form feed (\f) -- or -- <space>#$9#$A#$D#$C. The same as [ \t\n\r\f].

Declaration

RegExprObj.SpaceChars

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

A string that contains characters treated as "whitespace characters".

Example

The following code specifies a character to be treated as a "whitespace character" and finds matching text segments.

DelphiScript

procedure SpaceCharsSample;

var
  MyRegExpr : OleVariant;
  Input, Expr, ResStr : string;
begin
  MyRegExpr := HISUtils.RegExpr;
  Input : = '[email protected]@file@stores@the@project@suite@settings.';
  // Specifies that the @ character will be treated as the \s character
  MyRegExpr.SpaceChars := '@';
  Expr := '[\w]+\s+[\w]+';
  MyRegExpr.Expression : = Expr;

  if MyRegExpr.Exec(Input) then    begin
      repeat
        begin
          // Posts the pairs of words separated by the \s character to the log
          ResStr := MyRegExpr.Match[0];
          Log.Message(ResStr);
        end;
      until not MyRegExpr.ExecNext;
    end;

end;

See Also

Regular Expressions Syntax
Using Regular Expressions in Scripts
WordChars Property
LineSeparators Property
LinePairedSeparator Property

Highlight search results