mIRC Home    About    Download    Register    News    Help

Print Thread
#103628 23/11/04 10:16 AM
Joined: Feb 2004
Posts: 119
D
da_hype Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Feb 2004
Posts: 119
alias swear {
return $regex($1-,/(dick)|(penis)/g)
}

when someone types "dickless" it still returns 1. how to make it return 1 when only "dick" is typed?

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Encapsulate the words with the \b, meaning word boundary. It will only trigger then if it is surrounded by a non-word character, like punctuation or a space etc.

alias swear return $regex($1-,/\b(?:dick|penis)\b/Sig)

EDIT: Check out this regex tutorial.

Joined: Feb 2004
Posts: 119
D
da_hype Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Feb 2004
Posts: 119
how would i do this?

Code:
alias spam { 
var %con = http|www
return $regex(http,/\b(?:%con)\b/Sig) 
}

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
alias spam { 
  var %con = http|www
  return $regex([color:red]$1[/color],/\b(?: [color:red]$+[/color] %con [color:red]$+[/color] )\b/Sig) 
}


Usage: $spam(<text to check for spamming>)

Of course, that's not really a good idea, since "http" and "www" can appear in a conversation without being spam.


New username: hixxy

Link Copied to Clipboard