Επεξεργασία

Κοινή χρήση μέσω


RegularExpressionValidator.ValidationExpression Property

Definition

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
Email \w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)
Phone number ((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}
URL http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?

Applies to

See also