Regular Expression; Find whether a line contains any word with more than X characters.

Posted by Simpsoid on Stack Overflow See other posts from Stack Overflow or by Simpsoid
Published on 2010-06-03T05:13:53Z Indexed on 2010/06/03 5:24 UTC
Read the original article Hit count: 197

Filed under:
|
|

Hi,

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

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about regex