diff --git a/index.js b/index.js index e2c1059..5ee0f20 100644 --- a/index.js +++ b/index.js @@ -84,7 +84,8 @@ TextStatistics.prototype.wordCount = function(text) { text = text ? cleanText(text) : this.text; - return text.split(/[^a-z0-9]+/i).length || 1; + matches = text.match(/[\d\w]+/ig); + return matches ? matches.length : 0; }; TextStatistics.prototype.averageWordsPerSentence = function(text) {