I'm building a spam blocker which has lots f experssions it can get (so instead of using lots of elseif statemens I use a hash table with regular expressions because I want some of the data inside the spam to be returned).

For example:

1 ----- (?i)It seems that you have been infected with (.*) please download a cleaner for this virus
2 ----- (?i)HI! My name is (.*) I need boyfriend

Now I use:
on *:NOTICE:*:?: {
if ($hfind(spam,$1-,1,R).data > 0) {
echo 4 -a $v1 $regml(1)
(Its for testing. In real life it gets provate messages and not notices).

I would assume that when it finds the first item I told it to find, it would halt and return, so I could regrieve the $regml(1), but infact, with all the 60 (or more) spam messages that I have, I can get the $regnl(1) from only one spam message... I'm guessing that it is the last message inside the hash table (When it is not the last one then the search continues and the $regml(1) is being erased).

Wouldn't it be logical to return to the script as soon as it should the first result so the $regml will not be deleted? confused
(Otherwise, what a good reason would I have to use regual expressions ??? confused, I could just use wild card. I know that not all expressions can be written in wildcard form).

Thanks wink

Btw, would anyone suggest a way to get the $regml anyway or using another fast method (and not elseif statements which can be slow when dealing with lots of expressions, and while assumeing the worst case scenario that the expresion I'm looking for is the last one in the elseif statements).

Last edited by saragani; 15/08/04 07:46 PM.