Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8306449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:20:01+00:00 2026-06-08T18:20:01+00:00

Ok so I have a regular expression validator on my form but I am

  • 0

Ok so I have a regular expression validator on my form but I am new to it and was wondering how I add another expression to it so I can look for something else as well. Here is my sample code:

<asp:RegularExpressionValidator 
     ID="RegularExpressionValidator3" 
     ControlToValidate="txtRelationship" 
     ValidationExpression="^[a-zA-Z''-,\'.'\s]{1,30}$"
     EnableClientScript="true"  
     Display="None" 
     ValidationGroup="<%# ((TSAPassenger)((RepeaterItem)Container.Parent.Parent).DataItem).PaxKey %>" 
     runat="server" 
     ErrorMessage="Invalid Relationship.">
     Invalid Relationship
</asp:RegularExpressionValidator>

I am trying to add in if the field name is equal to “test” or “tba” to give the same error or a different error. How would I add another expression into this?


Would the second validation look like this?

 <asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="txtName" ValidationExpression="^.*\b(test|tba)\b.*$"
                                        EnableClientScript="true"  Display="None" ValidationGroup="<%# ((TSAPassenger)((RepeaterItem) Container.Parent.Parent).DataItem).PaxKey %>" runat="server" ErrorMessage="This can not be used as a Contact Name."></asp:RegularExpressionValidator>
                                     <asp:RequiredFieldValidator ID="RequiredFieldValidatorName" ControlToValidate="txtName" Enabled="<%# (Container.ItemIndex == 0 || Container. = "test") %>" ValidationGroup="<%# ((TSAPassenger)((RepeaterItem) Container.Parent.Parent).DataItem).PaxKey %>" runat="server" ErrorMessage="Contact Name is required."></asp:RequiredFieldValidator>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:20:01+00:00Added an answer on June 8, 2026 at 6:20 pm

    The best solution would be IMHO to use a custom validator and code your validations in the onServerValidate event.

    Of course, you can always add another regExp validator or even a compare validator to the same object you are validating.

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a textbox and a regular expression validator applied to it. I want
I have the following regular expression validator to detect whether an input string contains
I have this regular expression to help me validate a form input. var nrExp
i have created this regular expression for my form validation of password feild /^[[A-Za-z0-9]+[A-Za-z0-9,
I have 20-25 textboxes in the form. should I use regular expression control in
I have a regular expression to validate the dates and it works fine, this
I have a regular expression to validate a input value. At this point I
I have this light regular expression to validate the coordinates: ^([0-9.,-]+){18,20}$^ . If the
I have a regular expression ^[a-zA-Z+#-.0-9]{1,5}$ which validates that the word contains alpha-numeric characters
i want a regular expression to validate string to have only text,operators and these

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.