Regex for javascript to count words (excluding numbers) -


i have function

string.prototype.countwords = function(){     return this.split(/\s+\b/).length; } 

which counts words in textarea, counts numbers inserted, wondering how count words not numbers, ignoring numbers,

the following regex might out:

string.prototype.countwords = function(){     return this.split(/\s+[^0-9]/).length; } 

the ^ negates characters in brackets, characters allowed follow whitespaces except numbers.

by way: here place test regex: http://regexpal.com/


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -