Share via


RegexStringValidatorAttribute.Regex 屬性

定義

取得用來執行規則運算式驗證的字串。

public:
 property System::String ^ Regex { System::String ^ get(); };
public string Regex { get; }
member this.Regex : string
Public ReadOnly Property Regex As String

屬性值

包含規則運算式的字串,此規則運算式是用來篩選指派給裝飾的組態項目屬性的字串。

範例

下列範例將示範如何使用 Regex 屬性。


ConfigurationValidatorBase valBase;

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

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

Dim rstrValAttr As _
New RegexStringValidatorAttribute("\w+\S*")

' Get the regular expression string.
Dim regex As String = _
rstrValAttr.Regex
Console.WriteLine( _
"Regular expression: {0}", regex)

適用於