Originally Posted By: Wims
Code:
/search3 {
  var %hash seen ,%search QUIT ,%a = $hfind(%hash,$+(*,%search,*),0,w).data
  echo -s total: %a
  while (%a) {
  var %h $hfind(%hash,$+(*,%search,*),%a,w).data
  echo -s %h is $hget(%hash,%h)
    dec %a
  }
}


Edit : It was showing weird result because your code was false, The data of the Nth item is not for sure the data of the N match


Thanks, I'd wondered about that, but I didn't know how to fix it. What about this code to wildcard search item names? It worked the way I had it, but I updated it to correct the wildcard string. Same result.

Code:
/search {
  var %hash = seen ,%search = apple, %a = 1
  while ($hfind(%hash,$+(*,%search,*),%a,w)) {
    echo -s %a : $hfind(%hash,$+(*,search,*),%a,w) is $hget(%hash,%a).data
    inc %a
  }
}