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

  • SEARCH
  • Home
  • 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 847955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:52:14+00:00 2026-05-15T06:52:14+00:00

I am trying to use a Validator on a ASP.NET site and need to

  • 0

I am trying to use a Validator on a ASP.NET site and need to find whether the Street Address textbox contains a valid entry.

Entries with words that are longer than X characters (in this case 25, with no punctuation or spaces) will cause the HTML on a printed A4 page to not wrap properly and therefore not to confrom to certain sizes correctly pushing the margins off.

For a street address I want to match that something like “201 Long Road” is valid but “235 ReallyLongAndNarrowWindingRoadBesideTheRiver Street” is invalid.

Using a Microsoft .Net Regular Expression Validator I need to know what the RegEx pattern might be.

I think if it does find a match the Validator will fire correctly however if there is no match the Validator won’t fire and the Update button (in this case) won’t fire.

Since Street addresses can contain Capital Letters and numbers etc. it will need to accomodate for that and also Spaces, Commas, Semi-Colons and Colons and Hyphens are valid characters too.

Any help would be greatly appreciated as I am really stuck with this problem.

Thanks,
David

  • 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-05-15T06:52:14+00:00Added an answer on May 15, 2026 at 6:52 am

    Use negative assertion:

    (?!.*\S{25})
    

    \S{25} matches a sequence of 25 \S (which must be a subsequence of anything longer). (?!pattern) is a negative lookahead, an assertion that is true if the pattern doesn’t match. .* allows the lookahead to look as far as necessary.

    The whole pattern therefore is

    ^(?!.*\S{25}).*$
    

    This matches all string that do NOT contain \S{25} (see it in action on rubular.com, with threshold 10).

    See also

    • regular-expressions.info/Lookarounds
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use ASP.NET Server Controls (ASP.TextBox etc) with MVC (to take
I'm trying to use asp.net mvc's 2 client validation ( <% Html.EnableClientValidation(); %>) with
I need to validate a DropDownList in an ASP.NET project and am trying to
I am new to asp .net. I am trying to use the JQuery library
Im trying to use ASP.NET login controls, in a ASP.NET MVC project and i
I'm trying out ASP.NET MVC 2 Preview and when I use client side validation
I'm trying to use Sharp Architecture to develop ASP.NET MVC 3 app. But I
I've got a simple address entry app that I'm trying to use the IDataErrorInfo
I'm trying to use the built in ASP.NET MVC 2 client side validation on
I'm trying to use DataAnnotations to add validation to my models in asp.NET MVC

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.