The problem with a wildcard scan is that it will ignore the comma delimiters, and match on the whole data part.

Here's a "rough" hfind(r) [regex search] approach; I adapted these regexes from this script.
It may not be optimized for performance (one would have to follow Genius' suggestions), and the output may be improved with some $addtok-routine instead of a "one nick - one line" play.
Another idea would be to limit a max. number of matches (prevent playback of the whole dataset if someone does a !serchip *.*.*.* or the like)...

Code:
on *:text:!searchip &:*: {
  if (. !isin $2) {
    if (($2 !isnum) && ($hget(userips,$2))) { .msg $nick $2 $+ 's IPs are: $v1 }
    else { .msg $nick No matches for nick $qt($2) }
  }
  else { 

    ; $1 is a valid (wildcard-)IP "A.A.A.A" (where each A is 1-3 digits/wildcards)
    var %isipreg = /^(?:(?:\d|\*|\?){1,3}\.){3}(\d|\*|\?){1,3}$/

    if ($regex($2,%isipreg)) {
      ; replaces to build a regex that will match wild-IP $2 in a comma-delimited string of IPs
      var %findreg = $replace($regsubex($2,/\*+/g,*),.,\.,*,\d*,?,\d) 
      var %findreg = $+(/(?<=^|\54),%findreg,(?=$|\54)/)

      write -c searchip.txt

     ; perform hfind loop, write results to a file
      var %n = 1
      while ($hfind(userips,%findreg,%n,r).data) {
        write searchip.txt $v1
        inc %n
      }

      var %l = $lines(searchip.txt)
      if (%l = 0) { .msg $nick There are no matches for IP $qt($2) }
      else { 
        ; sort file, play results to nick
        filter -ffct 1 32 searchip.txt searchip.txt
        .msg $nick There $iif((%l == 1),is %l match,are %l matches) for IP $qt($2) : 
        play -m2 $nick searchip.txt 300
      }
    }
    else { .msg $nick Wrong Syntax. use !searchip <nick> or !searchip <IP>. <IP> has to be N.N.N.N and may contain wildcards. }
  } 
}


...hope it's of use

Last edited by Horstl; 29/11/08 11:14 PM.