RegularExpressionValidator.ValidationExpression Propriedade

Definição

Obtém ou define a expressão regular atribuída para ser os critérios de validação.Gets or sets the regular expression assigned to be the validation criteria. O valor padrão é uma cadeia de caracteres vazia ("").The default value is an empty string (""). Esta API está obsoleta.This API is obsolete. Para saber mais sobre como desenvolver aplicativos móveis ASP.NET, veja Mobile Apps & Sites with ASP.NET (Aplicativos móveis e sites com ASP.NET).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

Valor da propriedade

String

A expressão regular atribuída para ser os critérios de validação.The regular expression assigned to be the validation criteria.

O RegularExpressionValidator não executa a validação em uma cadeia de caracteres vazia.The RegularExpressionValidator does not perform validation on an empty string. Para testar uma cadeia de caracteres vazia, use os controles RequiredFieldValidator e RegularExpressionValidator juntos.To test for an empty string, use the RequiredFieldValidator and RegularExpressionValidator controls together.

Atributos

Exceções

A expressão regular atribuída foi formada incorretamente.The regular expression assigned was malformed.

Comentários

A tabela a seguir mostra algumas expressões de validação de exemplo:The following table shows some sample validation expressions:

Tipo de validaçãoType of Validation Expressão de validaçãoValidation Expression
EmailEmail \w + ([-+.] \w +) * @\w + ([-.] \w +) * \ .\w + ([-.] \w +)\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)
Número do telefonePhone number (( \ \d {3} \ )?) | (\d {3} -))? \d {3} -\d{4}((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}
URLURL http://([\w-] + \ .) + [\w-] + (/[\ w-./?% &=] *)?http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?

Aplica-se a