If you upgrade to FMP 10, the phone number will be counted as one word.
However, the upgrade from 6 to 10 is a big jump and the conversion could create other problems when it solves this one. I'd download a trial copy of 10 and experiment with it before deciding to convert the file.
By the way, you seem to have started this thread twice. If you want, you can delete the other one by clicking on the options menu above the Kudos control.
A version 6 work around might be:
wordcount(Substitute(textfield, "-", ""))
Dear PhiModJunk: I think that did it! As I gather, the substitution of the "-" for "" does not actually eliminate it from the copy, but just for the wordcount calculation, yes? Because we need the hypens in the phone numbers when we export the text. This is wonderful, so far! THANKS!
By the way: Is there a wildcard for recognizing numbers, especially a string of numbers? i.e., searching for (###), where "#" is any number, and converting it to ### (removing the parentheses), for sake of calculation? This would make wordcount of phone numbers more compatible with the different manners in which people submit phone numbers. Of course, the clunky thing would be to make formatting consistent, manually. Hmmm...
"As I gather, the substitution of the "-" for "" does not actually eliminate it from the copy, but just for the wordcount calculation, yes? Because we need the hypens in the phone numbers when we export the text."
You gather correctly. Be aware that since the hyphen could be used for other purposes in your text, it may affect your word count when the hyphen is used for another purpose in the text.
(Forgive me, I am new to this and hopefully am not doing something against forum posting etiquette...)
Thanks, PhilModJunk. Yes, the "-" substitution does alter the wordcount for things like "two-bedroom", which we count as two words. Again, is there no numeric wildcard in FMPro6? Or is there a way to define a term where "#" ="0–9", and then insert that into the wordcount solution?
The only wildcards are in find requests that I know of--which won't do what you want.
Assuming you don't want "alpha-bravo-charlie" to count as one word, try a series of nested substitutions:
1. Substitute all digits other than "0" with "0";
2. Substitute "0-0" with "00"
Count the words of the result.
(Pardon me for not spelling this out, as it's very tedious to do in version 6 syntax - one more reason to upgrade.)
Thanks both of you for the advice so far. I have been drawing on my HS algebra to remember how the nesting rules work. I just cannot get the proper nesting order for the substitution to work. I've tried:
WordCount(((((((((Substitute(Copy, "1", "0") and (Substitute(Copy, "2", "0") ... (Substitute(Copy, "0-0", "00")))))))))))
I know the nested substitution functions have to be enclosed within the WordCount function, but do they add or do they require a logical "and"? I've tried both and some results return a count only when there's a hyphenated number, other times, I get "1" as the total count, no matter how many words are in the "Copy" field.
Could you help me with the pattern or structure of a couple of nesting terms, so that I could experiment further? THANKS again!
The first three:
Substitute ( YourField,
"1", "0" ),
"2", "0" ),
"3", "0" )
Brillant!!! Thank you both for your above and beyond the call help. I can only hope to get so proficient that I'd be able to help someone in such a bind. Anytime you want to submit a classified ad in Yellow Springs, the wordcount will be accurate now. —MM