I\'m trying to put together a regular expression for a JavaScript command that accurately counts the number of words in a textarea.
One solution I had found is as fo
my simple JavaScript library, called FuncJS has a function called "count()" which does exactly what it's called — count words.
For example, say that you have a string full of words, you can simply place it in between the function brackets, like this:
count("How many words are in this string?");
and then call the function, which will then return the number of words. Also, this function is designed to ignore any amount of whitespace, thus giving an accurate result.
To learn more about this function, please read the documentation at http://docs.funcjs.webege.com/count().html and the download link for FuncJS is also on the page.
Hope this helps anyone wanting to do this! :)