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 8191769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:59:27+00:00 2026-06-07T03:59:27+00:00

i have a regular expression on ASP.net textbox control that validate for user input

  • 0

i have a regular expression on ASP.net textbox control that validate for user input it should be only letters and numbers within 6 to 200 character
this is my code

<asp:TextBox ID="txtCategory_description" runat="server" Style="width: 485px;" Height="70px"
                                                            TextMode="MultiLine"></asp:TextBox>
                                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Invalid Category name"
                                                            ValidationExpression="^[a-zA-Z0-9._-]{6,200}$" ControlToValidate="txtCategory_description"
                                                            Display="None"></asp:RegularExpressionValidator>

the problem is where i wrote in the textbox any HTML code like it accept it and send me to error page of
can any one help me ??

note : on my page i have another regular expressions if i left all of them wrong , that regular expression also work well , the problem appear if it is only the wrong one

  • 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-07T03:59:28+00:00Added an answer on June 7, 2026 at 3:59 am

    ^([\-a-zA-Z0-9\._]){6,200}$

    Just as @user1428799 said, you need the 200, not 15.

    That should do it. Correct me if I’m wrong, but the hyphen needs to be placed in front (immediately after the [ otherwise it’s treated as a range character.

    Edit
    You can also just escape it as you may have to do so with the dot as well.

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

Sidebar

Related Questions

I have a asp.net textbox that uses a RegularExpressionValidator. If the regular expression fails,
I have a asp.net textbox for date input, I use regular expression to let
I have a regular expression that works fine for me when used in ASP.NET
I have a regular expression to validate a input value. At this point I
I have a regular expression ( \d{4}\w{3}(0[1-9]|[12][0-9]|3[01])([01][0-9]|2[0-3])([0-5][0-9]){2} ) that I need to validate the
My application is in ASP.NET 2.0 with C#. I have a regular expression validator
I have been using the following regular expression in ASP.NET and Javascript: [a-zA-ZöäüÖÄÜß0-9]{1}[a-zA-ZöäüÖÄÜß0-9_.\-]{2,14}[a-zA-ZöäüÖÄÜß0-9.!]{1} Now,
I wanted to write a regular expression using the ASP.Net RegExp validator that would
I have a textbox and have to use the regular expressions in asp.net My
I am trying to write a regular expression for ASP.NET MapPageRoute that matches a

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.