-
1. Re: Word Count - ignore numbers and symbols
Dave Saunders Aug 3, 2009 4:57 AM (in response to littlemookie)The script you need will be more complex. You're either going to have to look at each word before counting it or perhaps take the text of each story into a JavaScript string, use RegExp to eliminate words you want to ignore from the string and then count the remaining words.
By the way, the script you're using won't count words in tables or footnotes.
Dave
-
2. Re: Word Count - ignore numbers and symbols
pkahrel Aug 3, 2009 7:05 AM (in response to Dave Saunders)In CS3 and later you can use this:
app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = "[\\u\\l][-\\u\\l]+";
found = app.documents[0].findGrep ();
alert ("You have " + found.length + " words in this document.")A "word" is defined here as any string of upper- and lower-case letters and hyphens. Maybe that's too strict, but you can tweak the GREP to suit your needs.
Peter
-
3. Re: Word Count - ignore numbers and symbols
Dave Saunders Aug 3, 2009 7:41 AM (in response to pkahrel)Sometimes my mind gets into a state where it overlooks the fact that you can use GREP to just find things -- I think of it as a feature that changes text. D'oh. Peter's approach is far superior to what I blathered on about.
Dave


