RegularExpressionValidator.ValidationExpression Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the regular expression assigned to be the validation criteria. The default value is an empty string (""). This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.
public:
property System::String ^ ValidationExpression { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Bindable(true)]
public string ValidationExpression { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.ValidationExpression : string with get, set
Public Property ValidationExpression As String
Property Value
The regular expression assigned to be the validation criteria.
The RegularExpressionValidator does not perform validation on an empty string. To test for an empty string, use the RequiredFieldValidator and RegularExpressionValidator controls together.
- Attributes
Exceptions
The regular expression assigned was malformed.
Remarks
The following table shows some sample validation expressions:
Type of Validation | Validation Expression |
---|---|
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+) | |
Phone number | ((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4} |
URL | http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)? |