I dont have an original but here is a byte-based tally. It skips quoted words, but is also able to count individual quote marks.
function tally(string s,k) as sys
'
if s="" or k="" then exit function
byte sb at (strptr s)
byte kb at (strptr k)
sys lk=len k
sys ls=len(s)-lk+1
sys i=1
sys j
indexbase 1
'
do
if sb=34 or sb=39 or sb=96 ' " `
if sb<>kb
byte cq=sb
do 'SKIP QUOTE
@sb++
i++
if i>ls
jmp fwd done 'LIMIT
elseif sb=cq
exit do
end if
end do
end if
end if
if sb=kb
j=2
do
if j>lk
exit do
end if
if sb(j)<>kb(j)
j=0 : exit do 'NO MATCH
end if
j++
end do
if j>lk
function++ 'TALLY
i+=lk
@sb+=lk
continue do
end if
elseif i>ls
exit do 'LIMIT
end if
@sb++
i++ 'NEXT BYTE
end do
done:
end function
print tally("one,two,three,,`,q,`","`") '2
print tally("one,two,three,,`,q,`","`,q,`") '1
print tally("one,two,three,one,`,q,`","one") '2
print tally("one,two,three,one,`,q,`",chr(44)) '4