RegexPattern Property

Gets/sets the regular expression to which the constrained value must adhere.
Public Property RegexPattern As String
public string RegexPattern {get; set;}

RegexPattern validates the data value against a regular expression pattern. The value must match this patter for it be considered valid.

Here are some examples of regular expressions:

  • \d* - the text must be zero or more digits
  • \d+ - the text must be one or more digits
  • [a-d]+ - the text must be one or more instances of a, b, c, d characters
  • \d{3}-?\d{3}-?\d{4} - U.S. phone number pattern where '-' are optional

See .NET System.Text.RegularExpressions.Regex class for more information on the syntax of regular expressions. The Regex class is used to perform the matching.

Note: If the data value being validated is not a string object then it will be converted to string before performing this validation.


Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also