troubleshooting Question

Regular expression: Find long words

Avatar of webressurs
webressursFlag for Norway asked on
Regular ExpressionsASP.NET
8 Comments1 Solution989 ViewsLast Modified:
I have searched for a regex that check for long words in a text string. The text sting can be long, but any words in this string should not be longer than 20 characters. I have tried a lot of  different expressions, but all gives me the exeption even if no word is longer thean 20 chars (the total text is longer than 20 chars). I am using asp.net c#. Please see attached code.
I Have tried these expressions without luck:
 
ValidationExpression="^\S{20}$"
ValidationExpression="^\w{20}$"
ValidationExpression="^\w{20,}$"
ValidationExpression="^\b\w{20,}$"
ValidationExpression="^\b\p{L}{20,}$"
ValidationExpression="^\w{0,20}$"
ASKER CERTIFIED SOLUTION
webressurs

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros