mIRC Homepage
Posted By: da_hype another regex question.. - 23/11/04 10:16 AM
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?
Posted By: FiberOPtics Re: another regex question.. - 23/11/04 10:26 AM
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.
Posted By: da_hype Re: another regex question.. - 23/11/04 10:45 AM
how would i do this?

Code:
alias spam { 
var %con = http|www
return $regex(http,/\b(?:%con)\b/Sig) 
}
Posted By: tidy_trax Re: another regex question.. - 23/11/04 10:48 AM
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.
© mIRC Discussion Forums