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
Try to count anything that is not whitespace and with a word boundary:
value.split(/\b\S+\b/g).length
You could also try to use unicode ranges, but I am not sure if the following one is complete:
value.split(/[\u0080-\uFFFF\w]+/g).length