WordChars Property

Applies to TestComplete 14.0, last modified on January 23, 2019

Description

Use the RegExpr.WordChars to specify which characters will be treated as \w.

The default value is all alphanumeric symbols and underscore -- or -- 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_.

Declaration

RegExprObj.WordChars

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 that contains characters treated as "word characters".

Example

The following example demonstrates how to use this property. The code specifies characters to be treated as word characters and finds matches for the new word characters in the specified expression.

DelphiScript

procedure WordCharsSample;

var
  MyRegExp: OleVariant;
  ResStr: String;
  Exp: string;
begin

  MyRegExp:=HISUtils.RegExpr;
  ResStr:='';
  // Specifies the text to which the regular expression will be applied
  Exp := 'Rest, Test, Plan, tseT';
  // Specifies the characters treated as 'word characters'
  MyRegExp.WordChars := 'EeSsTt';
  // Specifies patters
  MyRegExp.Expression := '[\w]+';

  if MyRegExp.Exec(Exp) then
  Repeat
    ResStr := ResStr + MyRegExp.Match[0] + '; ';
  Until not MyRegExp.ExecNext;

  Log.Message(ResStr);
end;
// Posts the following to the log:
// est; Test; tseT

See Also

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

Highlight search results