RegexStringValidatorAttribute.Regex Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets the string used to perform regular-expression validation.

Namespace:   System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)

public string Regex { get; }

Property Value

Type: System.String

The string containing the regular expression used to filter the string assigned to the decorated configuration-element property.

The following example shows how to use the Regex property.

ConfigurationValidatorBase valBase;

RegexStringValidatorAttribute rstrValAttr =
new RegexStringValidatorAttribute(@"\w+\S*");

// Get the regular expression string.
string regex = rstrValAttr.Regex;
Console.WriteLine("Regular expression: {0}", regex);

.NET Framework
Available since 2.0
Return to top