mIRC Home    About    Download    Register    News    Help

Topic Options
#103628 - 23/11/04 10:16 AM another regex question..
da_hype Offline
Vogon poet

Registered: 29/02/04
Posts: 119
Loc: Logan, Utah (USA)
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?

Top
#103629 - 23/11/04 10:26 AM Re: another regex question..
FiberOPtics Offline
Hoopy frood

Registered: 05/02/04
Posts: 2019
Loc: Leuven, Belgium
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.

Top
#103630 - 23/11/04 10:45 AM Re: another regex question..
da_hype Offline
Vogon poet

Registered: 29/02/04
Posts: 119
Loc: Logan, Utah (USA)
how would i do this?

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

Top
#103631 - 23/11/04 10:48 AM Re: another regex question..
tidy_trax Offline
Hoopy frood

Registered: 02/11/03
Posts: 2327
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

Top