Name
RegularExpressionValidator
Synopsis
The RegularExpressionValidator is a type
of validation control that compares an input control against a pattern specified in
the ValidationExpression.
Regular expression validation is ideally suited for verifying predictable
sequences of characters, such as those in social security numbers, email addresses,
telephone numbers, and postal codes. Validation will succeed if the input control is
empty, unless you also use a RequiredFieldValidator control.
Validation is always performed on the server. If the client browser supports
JavaScript, validation will be performed there as well, which can save a roundtrip if
errors are present. The regular expression validation performed by the JavaScript
code is a subset of the full System.Text.RegularExpressions.Regex
syntax.
Public Class RegularExpressionValidator : Inherits BaseValidator ' Public Constructors Public Sub New() ' Public Instance Properties Public Property ValidationExpression As String ' Protected Instance Methods Overrides Protected Sub AddAttributesToRender( ByVal writer As System.Web.UI.HtmlTextWriter) Overrides Protected Function EvaluateIsValid() As Boolean End Class
Hierarchy
System.Object→ System.Web.UI.Control(System.ComponentModel.IComponent, System.IDisposable, System.Web.UI.IParserAccessor, System.Web.UI.IDataBindingsAccessor)→WebControl(System.Web.UI.IAttributeAccessor)→Label→BaseValidator(System.Web.UI.IValidator)→ RegularExpressionValidator
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access