mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2014
Posts: 54
O
Orobas Offline OP
Babel fish
OP Offline
Babel fish
O
Joined: Oct 2014
Posts: 54
Hi Folks...

Running a very basic filter script to try and catch mum/mom/mother nicks and for the most part it works fine. The only issue we have is when numbers are added to the end of the nick and the script no longer catches them. I have tried to add \{\d+:\d+\} to the end of the catch but it doesnt work.. could i have a fix please?

The partial script with the catcher is...
Code
on ^*:snotice:*:{
  if (is now a isin $1-) {
    window -nek @StatusNotice
    aline -hp  @StatusNotice 4 $+ $1- at $time on $date
    haltdef
  }
  if (Client connecting isin $1-) {
    window -nek @Connecting
    aline -hp  @Connecting 4 $+ $1- at $time on $date on $network
    msg #mastercontrol 6CONN $4 at $time and their IP is $remove($6,$chr(91),$chr(93))
    ;echo -s connecting ip $4 is $remove($6,$chr(91),$chr(93))
    if (*mum iswm $4) /msg #filters 8,1CHECK NICK  mum based nick. check it - $4
    if (mother* iswm $4) /msg #filters 8,1CHECK NICK  mother based nick. check it - $4
    if (*mom iswm $4) /msg #filters 8,1CHECK NICK mom based nick. check it - $4
    if (mom* iswm $4) /msg #filters 8,1CHECK NICK mom based nick. check it - $4
    if (*mom[\{\d+:\d+\} iswm $4) /msg #filters 8,1CHECK NICK mom based nick. check it - $4


I'm trying to catch nicks like boredmom12 or strangemom98 etc etc...

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
The reason this doesn't work is that "iswm" means "is wildcard match", so mom* matches only when it begins the string, *mom matches only when it ends the string, and using regex symbols would match only when the nick contained things like literal \d characters.

mIRC also has the ISIN operator where (string1 isin string2) is basically the same thing as (*string1* iswm string2). If you want to use regex matches, you'd need to use the $regex identifier which returns negative numbers for some kinds of syntax errors, or otherwise returns the number of matches, which is 0 or 1, unless using the /g flag which allows multiple matches.

There are case-sensitive iswmcs and isincs, which you're probably not wanting. However regex by default is case-sensitive unless you wrap your search inside the /i flag. In your case, you can do something like this to check for several matches, and I get the impression you don't care whether or not it ends with a number, so there should be no need to mention them in your match checking:

if (mom isin $4) msg #filters message
if (mother isin $4) msg #filters message

is the same as
if ( (mom isin $4) || (mother isin $4) ) msg #filters message

is the same as
if ((*mom* iswm $4) || (*mother* iswm $4) ) msg #filters message

and you can do quite a few of these 'isin' type checks in a single case-insensitive regex
if ( $regex($4,/(?:mom|mother|mum)/i) > 0) msg #filters message

It's good that you're not automatically acting on matches, since 'isin' type matches can easily have false matches for strings like momentum or smother.

Joined: Oct 2014
Posts: 54
O
Orobas Offline OP
Babel fish
OP Offline
Babel fish
O
Joined: Oct 2014
Posts: 54
Hiya Maroon

It is the numeric i am trying to catch .. always 2 digits afterwards like in the example i gave on my original post.

For the life of me i cant work out the edit lol..

I know //say $right(boredmom32,2) returns 32 which means something like $right($nick,2) isnum but how to code it in i have no idea hence why i am here for the fix and code dear Sir!

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
I didn't understand that you were wanting something that ALWAYS ended with the mom-word followed by exactly 2 numbers, you can match like:

if ( $regex($4,/(?:mom|mother|mum)\d\d$/i) > 0) msg #filters message

If that isn't matching what you want, or is matching things it should not, it helps to match regex if you can provide the types of things it should match, and very similar things it should not. If there can be text between the mom-word and the number, you can insert .* immediately preceding that 1st \d - though that can match when someone has a 3-digit number. If they switch to having a variable size number like mom123, then replace the \d\d with \d+

Joined: Nov 2021
Posts: 91
Babel fish
Offline
Babel fish
Joined: Nov 2021
Posts: 91
this should work with and without digits in it

Code
 if ($regex($4,/(m[0u]m|m[0o]th[3e]r)/i)) { do stuff } 

Joined: Oct 2014
Posts: 54
O
Orobas Offline OP
Babel fish
OP Offline
Babel fish
O
Joined: Oct 2014
Posts: 54
hiya Maroon

It would appear for the moment, that your edit is working

10:03] <Titan_Bot> 8,1CHECK NICK mom/mother/mum with numerics based nick. check it - amom34

I appreciate your time and candour on this thread and if i run into any issues i will report back on this thread, otherwise a huge thanks for your assistance


Link Copied to Clipboard