in reply to Counting instances of words

You are attempting to count occurances of and AFTER you've already made the substitutions.

Others may give advice on coding style, I'm off to lunch.

Phil

The Gantry Web Framework Book is now available.