Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Collapse]Editors and Simple Controls
   [Collapse]Simple Editors
    [Expand]Included Components
    [Expand]Editors Structure
    [Collapse]Editors Features
      Text Editing Overview
     [Collapse]Mask Editors Overview
       Mask Type: Numeric
       Mask Type: Date-time
       Mask Type: Extended Regular Expressions
       Mask Type: Simple
       Mask Type: Simplified Regular Expressions
     [Expand]Formatting and Parsing Values
     [Expand]Editor Buttons Overview
     [Expand]Dropdown Editors Overview
      Image Editing Menu
     [Expand]Data Binding Overview
     [Expand]Appearance Customization
     [Expand]Miscellaneous Features
    [Expand]Member Tables
    [Expand]Examples
   [Expand]Lookup Editors
   [Expand]Token Edit Control
   [Expand]Breadcrumb Edit Control
   [Expand]Range Control
   [Expand]Image Slider
    Camera Control
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Mask Type: Simplified Regular Expressions

Simplified regular expressions don't support as many features as Extended Regular Expressions. For instance, they don't support alternative valid forms for values, they also lack the auto-complete feature, etc.

Simplified regular expressions are provided for backwards compatibility with version 2 of the XtraEditors. It's possible to use the Extended Regular Expressions in your applications instead which give you more flexibility and facilities to input data. For information on the other masked modes refer to the Mask Editors Overview document.

In this topic:

Expanded Simplified Regular Expressions

Simplified regular expressions can be used in two cases. The first case occurs when you need to specify a custom range of characters for a specific position. The second case is when you need to provide a mask of variable length.

To construct masks using the simplified regular expressions set the MaskProperties.MaskType property of the RepositoryItemTextEdit.Mask object to MaskType.Regular. The mask itself should be specified via the MaskProperties.EditMask property.

A mask represents a string which can consist of metacharacters, quantifiers, special and literal characters.

Expanded Metacharacters

Metacharacters are used to represent a range of symbols. An end-user can enter text only in the positions corresponding to metacharacters. When a metacharacter is found in a specific position in the mask an end-user can enter any character from the related range in this position in the edit box. The following table lists the available metacharacters:

Character Description
. Matches any character.
[aeiou] Matches any single character included in the specified set of characters.
[^aeiou] Matches any single character, which is not included in the specified set of characters.
[0-9a-fA-F] Use of a hyphen () allows specification of contiguous character ranges.
\w Matches any word character. \w is the same as [a-zA-Z_0-9].
\W Matches any nonword character. \W is the same as [^a-zA-Z_0-9].
\d Matches any decimal digit. Same as [0-9].
\D Matches any nondigit. Same as [^0-9].

Expanded Quantifiers

These are special characters which denote the number of repetitions for the preceding character. Review the table below for the list of qualifiers and their descriptions.

Quantifier Description
* Specifies zero or more matches; for example, \w* or [a-zA-Z]*. Same as {0,}.
+ Specifies one or more matches; for example, \w+ or [a-zA-Z]+. Same as {1,}.
? Specifies zero or one matches; for example, \w? or [a-zA-Z]?. Same as {0,1}.
{n} Specifies exactly n matches; for example, [0-9]{2}.
{n,} Specifies at least n matches; for example, [0-9]{2,}.
{n,m} Specifies at least n, but no more than m, matches.

Expanded Special Characters

The following table lists the available special characters which are used to control the case of the input string and to represent various delimiters and currency symbols.

Character Description
> If a > character appears in the mask, all the characters that follow it are in uppercase until the end of the mask or until a < character is encountered.
< If a < character appears in the mask, all the characters that follow it are in lowercase until the end of the mask or until a > character is encountered.
<> If these two characters appear together in the mask, no case checking is done and the data is formatted with the case used by the end-user during data entry.
/ A / character is used to separate months, days, and years in dates. If the character that separates months, days, and years is different in the regional settings of the system that the application runs on that character is used instead.
: A : character is used to separate hours, minutes, and seconds in time values. If the character that separates hours, minutes, and seconds is different in the regional settings of the system that the application runs on that character is used instead.
$ A $ character is used to designate currency values. If the character that designates currency values is different in the regional settings of the system that the application runs on that character is used instead.

Expanded Literal Characters

A character which is not used to represent a metacharacter nor quantifier nor special character is called a literal. Literals are inserted automatically as is into the edit box in the positions defined by the mask. An end-user has no need to enter literal characters. The cursor skips over them during editing.

A symbol used to represent a reserved character can also appear as a literal if preceded by a backslash (\).

Expanded Examples

1. A mask for entering hexadecimal values of any length: [0-9A-F]*

The [0-9A-F] substring specifies that any character from the [0-9] and [A-F] ranges can be entered. The * quantifier denotes that characters from the specified range can appear an unlimited number of times.

2. A mask that requires an end-user enter at least two digits of a hexadecimal number: [0-9A-F]{2,}

If less than two digits are entered the editor will indicate that the value is not valid:

3. A mask for entering a number that has two digits in its fractional part: \d*\.\d{2}

Since the '.' character is reserved the '\.' substring is used to insert the dot as a literal into the mask.

Expanded See Also

How would you rate this topic?​​​​​​​