Q:

can't get an asp:RegularExpressionValidator to work

I'm having an issue getting a regex field validator to work for an asp page i'm trying to update.
Here is the asp:Panel stripped down to the important bits:
<asp:Panel ID="pnlEmailAddressCollection" runat="server">
    <div id="POMInput-wrapper">
        <div class="POMInput-FieldText">
            <span class="POMInput-wrapper-text">Name:</span>

            <br />
            <span class="POMInput-wrapper-text">Email Address:</span>

            <br />
        </div>
        <div class="POMInput-FieldEntry">
            <asp:TextBox ID="txtEmailAddress" name="emailAddress" runat="server" CssClass="textInput"></asp:TextBox>
            <asp:TextBox ID="txtUserName" runat="server" name="firstName" CssClass="textInput"></asp:TextBox>
        </div>

        <asp:RequiredFieldValidator ID="rfvNameValidator"  runat="server" 
            ErrorMessage="Please enter your name"
            ControlToValidate="txtUserName" 
            Display="None" />

        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
            ErrorMessage="Please enter your email address"
            ControlToValidate="txtEmailAddress" 
            Display="None" />

        <asp:RegularExpressionValidator ID="rfvEmailValidator2" runat="server" 
            ErrorMessage="Please enter a valid email address" 
            ControlToValidate="txtEmailAddress"
            Display="None"
            ValidationExpression="^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}$" />

        <asp:ValidationSummary ID="ValidationSummary1" runat="server"
            ShowMessageBox="true" 
            ShowSummary="false"
            EnableClientScript="true" />                        
    </div>
</asp:Panel>

It is currently failing on any email i put in. The asp:RequiredFieldValidator's work as expected.
I tested the regular expression in a test project and the regex seems good (returns true on valid emails, false on invalid ones). Did I set up the asp:RegularExpressionValidator incorrectly?

A:

You should remove double backslash:
ValidationExpression="^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$" 

Note that you put two backslashes where you meant only one. If you were to set this expression from code behind, the string you provided is correct. But in aspx you don't have to escape backslash.
At the moment accepted email address would be something like abc@abc{backslash}.com

