Page 1 of 1

irc.blah

Posted: Tue Apr 17, 2007 2:55 am
by Oyarsa
Ok just getting into the spamfilters.

These are very cool I must say :-)

Anyway ... there is an example in the docs of:

/spamfilter add pc block - - come to irc\..+\..+


which is great but it also blocks my own irc net's name that way. How would I have it block all others save for my own?

Posted: Wed Apr 18, 2007 10:27 am
by JanisB

Code: Select all

<?php
$r = '/come to irc\.(?!blah\.).+/';
echo preg_match($r, 'come to irc.blah.net').'<br>';
echo preg_match($r, 'come to irc.net').'<br>';
echo preg_match($r, 'come to irc.le-blah.net');
?>
will output

Code: Select all

0
1
1

Posted: Sun Apr 22, 2007 1:12 am
by Jason
JanisB: UnrealIRCd uses the TRE, not PCRE, regular expressions engine.

Posted: Mon Apr 23, 2007 6:46 pm
by JanisB
According to homepage and syntax reference i found, that TRE knows, what (?!blah\.) is and how to match .+, so I think my example will work on Unreal. Sure, without beginning-end slashes :)

Posted: Tue Apr 24, 2007 12:26 am
by Jason
.+ and \., etc, are standard for all POSIX compliant regexes (and you're not really a regex if you don't understand them)

You're incorrect about the (?!blah\.) portion, however. It is in his todo list, not his features list.

Posted: Tue Apr 24, 2007 3:32 pm
by JanisB
http://laurikari.net/tre/ wrote:These are other features I'm planning to implement real soon now:
(?!pattern) Zero-width negative look-ahead assertions.
Oops, really... Sorry :<