I’m trying to write a regular expression that will validate that user input is greater than X number of non-whitespace characters. I’m basically trying to filter out begining and ending whitespace while still ensuring that the input is greater than X characters; the characters can be anything, just not whitespace (space, tab, return, newline).
This the regex I’ve been using, but it doesn’t work:
\s.{10}.*\s
I’m using C# 4.0 (Asp.net Regular Expression Validator) btw if that matters.
It may be easier to not use regex at all:
If whitespace shouldn’t count in the middle, then this will work:
If you don’t care about whitespace in between non-whitespace characters, the other answers have that scenario covered.