[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
  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
    Included Controls and Components
   [Collapse]Common Editor Features and Concepts
    [Collapse]Input Mask
      Mask Type: Numeric
      Mask Type: Date-time
      Mask Type: TimeSpan
      Mask Type: Extended Regular Expressions
      Mask Type: Simple
      Mask Type: Simplified Regular Expressions
    [Expand]Format and Parse Editor Values
     Custom Editors
   [Expand]Lookup Editors
    Popup Container Editor
   [Expand]Token Edit Control
   [Expand]Breadcrumb Edit Control
   [Expand]Range Control
   [Expand]Image Slider
    Camera Control
    Templated ListBox Controls
   [Expand]Examples
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [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]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Mask Type: Simplified Regular Expressions

Simplified regular expressions allow you to specify the entered text's pattern.

Note

Run the XtraEditors demo to try out input masks.

Tip

Simplified regular expressions support backward compatibility with XtraEditors version 2. We recommend that you use MaskType.RegEx type syntax because it supports additional features like alternative validation and autocomplete. See Extended Regular Expressions for more information.

Expanded Mask Type and Mask Expression

The RepositoryItemTextEdit.Mask property provides access to a MaskProperties class instance that specifies an input mask. Set the MaskProperties.MaskType property to MaskType.Regular to enable the simplified regex mask format. Use the MaskProperties.EditMask property to specify the mask expression.

Expanded Metacharacters

Metacharacters specify characters users can enter at the corresponding positions. The table below lists the available metacharacters.

Character Description
. Any single character.
[aeiou] Any single character from the specified character set.
[^aeiou] Any single character not from the specified character set.
[0-9a-fA-F] Any single character from the specified character range.
\w Any single alphanumeric character. The same as [a-zA-Z_0-9].
\W Any single non-alphanumeric character. The same as [^a-zA-Z_0-9].
\d Any single numeric character. The same as [0-9].
\D Any single non-numeric character. The same as [^0-9].

Expanded Quantifiers

Quantifiers follow a metacharacter and specify how many times the character should be repeated. The table below lists the available qualifiers.

Quantifier Description Examples
* Zero or more matches. The same as {0,}. [a-zA-Z]*, \w*
+ One or more matches. The same as {1,}. [a-zA-Z]+, \w+
? Zero or one matches. The same as {0,1}. [a-zA-Z]?, \w?
{n} Exactly n matches. [0-9]{2}
{n,} At least n matches. [0-9]{2,}
{n,m} At least n, but not more than m matches. [0-9]{2,7}

Expanded Special Characters

Special characters convert the entered text to uppercase/lowercase, insert delimiters and currency symbols. The table below lists the available special characters.

Character Description
> Converts subsequent characters to uppercase.
< Converts subsequent characters to lowercase.
<> Discards case conversion for subsequent characters.
/ Separates months, days, and years. The culture's System.Globalization.DateTimeFormatInfo.DateSeparator property specifies the actual character.
: Separates hours, minutes, and seconds. The culture's System.Globalization.DateTimeFormatInfo.TimeSeparator property specifies the actual character.
$ Inserts the currency symbol. The culture's System.Globalization.NumberFormatInfo.CurrencySymbol property specifies the actual character.

Expanded Literal Characters

Literal characters are arbitrary read-only characters in the edit box. If you add a character that is not a meta or special character into a mask expression, the character is displayed in the edit box as is. To display a meta or special character as a literal, precede it with a backslash.

Expanded Examples

Example 1

[0-9A-F]* - a mask to enter hexadecimal values of any length.

Example 2

[0-9A-F]{2,} - a mask to enter a hexadecimal value that consists of at least two digits.

If the user enters less than two digits, the editor displays a notification.

Example 3

\d*\.\d{2} - a mask to enter a number that has two decimal digits.

Expanded See Also

Is this topic helpful?​​​​​​​