Started writing the string_CountOf.  It's not hard, just got distracted.  Need to finish it and write tests.
Wrote a perl script to do the CountOf logic.  It works fine, except when dealing with hidden characters like newlines.  Perl can count them but Bash seems to ignore one.  For example, in a sample document with 7 or 8 lines I got #var to return 79, but perl returned 80 matches for all chars ([\s\S]).  Need to find out why this is happening and decide which is actually correct... my guess is perl.
Finished the CountOf function.  It's not as fast as I'd like, but I'm not sure how to improve the performance but still remain as flexible.
Added another test for kicks.