WordChars Property

Applies to TestComplete 14.80, last modified on April 21, 2021


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

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



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".


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.


procedure WordCharsSample;

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

  // 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
    ResStr := ResStr + MyRegExp.Match[0] + '; ';
  Until not MyRegExp.ExecNext;

// 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