Skip to main content

RegularExpressionValidationPattern.ValidationExpression Property

Gets or sets the regular expression that specifies the pattern used to validate an editor.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web


public string ValidationExpression { get; set; }

Property Value

Type Default Description
String String.Empty

A string that specifies the regular expression used to validate an editor for formatting.


Use this property to specify the pattern used to check for predictable sequences of characters, such as those in social security numbers, e-mail addresses, telephone numbers, and postal codes.

Regular expression validation of DevExpress editors covers all the editor text. That is, the regular expression defined via the ValidationExpression property is used to search for a match against the entire value of the validated editor (i.e., against the editor’s Text property value). Technically, it is similar to adding the “^” and “$” anchors at the beginning and the end of an expression (see Anchors in Regular Expressions).


  • If the ValidationExpression property value is specified using lookbehind regular expression, the editor value is not validated on the client side as the lookbehind regular expressions are not supported by JavaScript.
  • The ValidationExpression property can accept only a validation patter, but not flags.


<dx:ASPxTextBox ID="tbEMail" runat="server" Size="49" NullText="Enter e-mail ..." Font-Size="Small">
    <ValidationSettings  EnableCustomValidation="True" ErrorDisplayMode="Text" ErrorTextPosition="Bottom" SetFocusOnError="true">
        <ErrorFrameStyle Font-Size="Smaller"/>
        <RegularExpression ValidationExpression="^\w+([-+.'%]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$" 
            ErrorText="Invalid e-mail"/>
        <RequiredField IsRequired="True" ErrorText="E-mail is required"/>
    <NullTextStyle Font-Size="Small"/>
See Also