RegularExpressionValidator.ValidationExpression Property

Gets or sets the regular expression assigned to be the validation criteria. The default value is an empty string ("").

Namespace: System.Web.UI.MobileControls
Assembly: System.Web.Mobile (in system.web.mobile.dll)

[BindableAttribute(true)] 
public:
property String^ ValidationExpression {
	String^ get ();
	void set (String^ value);
}
/** @property */
public String get_ValidationExpression ()

/** @property */
public void set_ValidationExpression (String value)

public function get ValidationExpression () : String

public function set ValidationExpression (value : String)

Not applicable.

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.

Exception typeCondition

HttpException

The regular expression assigned was malformed.

The following table shows some sample validation expressions:

Type of Validation

Validation Expression

E-mail

\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)

Phone number

((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}

URL

http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1

Community Additions

ADD
Show: