to add to this idea. Instead of changing the way $hfind works, just make a command '/hfind':
/hfind -monwWrR <InTable> <OutTable> <match text>
; -m : Create OutTable if it does not exist
; -o : Clear OutTable if it exists(Can be coupled with -m to clear it if it exists, create it if it does not)
; -nwWrR : Same as $hfind()'s search switches
Then you could use $hget(OutTable,0) to get the number of matches found
But, as jaytest said, a for each loop would be nice:
for each -switches [other parameters] <input> {
if ($feitem == ForEachItem in <input>) {
/do stuff
}
}