<p>A requirement for an ASP.Net 2.0 project I'm working on limits a certain field to a max of 10 words (not characters). I'm currently using a CustomValidator control with the following ServerValidate method:</p>

<pre><code>Protected Sub TenWordsTextBoxValidator_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles TenWordsTextBoxValidator.ServerValidate
    '' 10 words
    args.IsValid = args.Value.Split(" ").Length &lt;= 10
End Sub
</code></pre>

<p>Does anyone have a more thorough/accurate method of getting a word count?</p>

You can use one of the builtin validators with a regex that counts the words.
I'm a little rusty with regex so go easy on me:
```
```
(\b.*\b){0,10}
```
```