Top

$regex Swear Kicker


mIRC Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  4.0 (of 1 scores)
Date Added  Sep 03, 2009
Last Updated  Sep 10, 2009
Tags  curse  cuss  kick  regex  swear 

Introduction

$regex swear kicker-I didn't see any other $regex swear kicks, so I thought I'd put one up. Feel free to add more words, I just put the naughty, naughty ones. I'm open to suggestions :)

Change Log

Action Support
Looks for swears in a /me action.

Full Sentence
Searches entire sentence for swears, instead of just the first word.

Word Differentiation
Can differentiate between works like @$$ and assume. [b]Added \b anchor to detect words exactly as specified; scans anywhere in the sentence.

Thank You Jethro_

Grab the Code

on *:load:*:{
  echo -a Y4ou L4oaD4eD M4iN4iCR4uZ4eR4'S 4$R4eG4eX SW4eaR K4iCK4eR
  echo -a If you need help you can find me on irc.codingpod.com #radio
}
 
on @*:TEXT:*:#: {
  var %swear = /^(\bnigger\b|\bmotherfucker\b|\bpussy\b|\bvagina\b)$/giS
  if ($nick !isop $chan) {
    if ($regex($1-,%swear)) { kick $chan $nick Please don't use that kind of language here. (Response to word: $1- $+ ) }
  }
}
on @*:ACTION:*:#: {
  var %swear = /(\bnigger\b|\pussy\b)/iS
  if ($nick !isop $chan) {
    if ($regex($1-,%swear)) { kick $chan $nick Please don't use that kind of language here. (Response to word: $1- $+ ) }
  }
}
 
 

Comments

  (31)  RSS
sunslayer
Comments: 266
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 3, 2009 10:33 pm
that regex will only trigger if the badword is at the end of $1- remove $ to allow it to be anywhere in $1-
Jethro_
Comments: 436
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 3, 2009 10:45 pm
Sunslayer, you are incorrect. The regex will match anywhere in a sentence. The $ makes sure the word ends in that particular letter. Without it, you will get kicked for pussyyyyyy with the letter y being repeated. Not unless, of course, you want a liberal, stricter foul word kick regex.
@miniCruizer: you can save yourself an if statement and a bracket by combining them with && operator:
Code:
on @*:TEXT:*:#: {
  var %swear = /(black|!@#$|pussy|v@#$)$/iS
  if ($nick !isop $chan) && ($regex($1-,%swear)) {
    kick $chan $nick Please don't use that kind of language here.
  }
}
elenoradicey
Comments: 1
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 3, 2009 10:53 pm
This is a terrific site! It has been very informative and useful to me. I have found several useful products. Just wanted to let you know how much I enjoy your website. I find it really useful. Thank you so much for all the info. I received from your sites!
Elenora
sunslayer
Comments: 266
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 3, 2009 11:13 pm
@ jethro //echo -a $regex(test black test,/(black|!@#$|pussy|v@#$)$/iS)

that returns $false, he is using $1- not $1 so the ending of $1- must match the regex
Ghost-writer
Comments: 256
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 3, 2009 11:13 pm
lawl ^ sounds like 1 of those adults trying to be smart, reminds me of my mom :P.
GlobalAnomaly
Comments: 77
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 3, 2009 11:25 pm
lmao. And, ew regex. I don't understand how mIRC uses em :(
sunslayer
Comments: 266
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 3, 2009 11:35 pm
Quote:
lawl ^ sounds like 1 of those adults trying to be smart, reminds me of my mom :P.

how do i sound like an adult tryin to be smart?
im simply stating a fact
Jethro_
Comments: 436
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 3, 2009 11:44 pm
sunslayer, you're partially right, but the fact of the matter is it does kick, without anything attached to the matching words:
Quote:
<Jason> John, stop acting like a pussy
* You were kicked by Jethro_ (:Please don't use that kind of language here.)
<jason> pussy
* You were kicked by Jethro_ (:Please don't use that kind of language here.)
But I would agree to remove the $ since it's not used for something with exact matching string that ends at the end.
Jethro_
Comments: 436
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 4, 2009 2:04 am
Actually, to back up my say, I forgot to add that you could run a simple to test and see for yourself:
Code:
on *:input:#:$regextest($1-)
alias regextest if $regex($1-,/(red|black)$/) { echo -a $true }
You will see if by removing $ or $1 or $1- will return $true upon the trigger red or black.
GlobalAnomaly
Comments: 77
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 4, 2009 2:57 am
Quote:

Quote:
Quote:

lawl ^ sounds like 1 of those adults trying to be smart, reminds me of my mom :P.


how do i sound like an adult tryin to be smart?
im simply stating a fact


I'm not sure, but I think he meant..

Quote:

This is a terrific site! It has been very informative and useful to me. I have found several useful products. Just wanted to let you know how much I enjoy your website. I find it really useful. Thank you so much for all the info. I received from your sites!
Elenora
miniCruzer
Comments: 47
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 4, 2009 3:26 pm
Wow thanks so much you guys!! Yeah, Jethro_ is correct. And another problem I'm having, is that it triggers the word "sn1gger".
Quote:

[4:21pm] <miniCruzer> freaking sn1gger
[4:21pm] You were kicked by Number`6 (Please don't use that kind of language here. (Response to word: freaking sn1gger))

[sorry I had to change it out so you could see. The 1 = an i)
jonesy44
Comments: 1,856
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 4, 2009 5:57 pm
/^(black|!@#$|pussy|v@#$)$/gSi
Jethro_
Comments: 436
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 4, 2009 6:58 pm
Yup, jonssy's got it there by adding a ^ symbol which'll match the start of a string. That piece of regex now ensures the words themselves are matched the way they are...no more or less.
miniCruzer
Comments: 47
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 4, 2009 7:59 pm
@jonesey44 - It only triggers if the sentence starts with the word, but other than that it does solve that problem, yet raises another. bah.
Jethro_
Comments: 436
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 4, 2009 9:40 pm
Actually I have to acknowledge the fact that using regex to kick bad words isn't 100% foolproof. miniCruzer, you might wanna try this:
Code:
on @*:TEXT:*:#: {
  var %cuss = 1, %swear = badword1 badword2 badword3 badword4
  while ($gettok(%swear,%cuss,32)) {
    if ($findtok($strip($1-),$v1,1,32)) {
      kick $chan $nick Please don't use that kind of language here.
    }
    inc %cuss
  }
}
This shall match exactly the way words are and anywhere in a sentence.
miniCruzer
Comments: 47
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 4, 2009 11:05 pm
Yeah I'm a little new at $regex. I've never even attempted Token Identifiers. Thankyou!!!
napa182
Comments: 1,454
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 5, 2009 12:47 am
lol @ Jethro_ & sunslayer
GlobalAnomaly
Comments: 77
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 5, 2009 1:05 am
Now to wait for napa to post a complicated code that nobody can read... :P
napa182
Comments: 1,454
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 5, 2009 2:28 am
there is nothing complicated about the scripts i have posted an if you cant read them then go read a few tutts. ;x
GlobalAnomaly
Comments: 77
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 5, 2009 2:38 am
urban dictionary (which is obv 100% true) begs to differ!
napa182
Comments: 1,454
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 5, 2009 3:38 am
*yawns*
pony
Comments: 12
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 5, 2009 3:45 am
#swear off
on *:text:*:#: {
if ($me !isop $chan) halt
if (($istok($1-,fark,32) == $true) || ($istok($1-,BITCH,32) == $true)) || (($istok($1-,@#$,32) == $true)) || (($istok($1-,pussy,32) == $true)) || (($istok($1-,wanker,32) == $true)) || (($istok($1-,cock,32) == $true)) || (($istok($1-,black,32) == $true)) {
if ($nick isowner $chan) goto test
if ($nick isop $chan) goto test
if ($readini(protection.ini, $nick, swear) != true) {
.msg $nick ( $nick ) Please do not swear on $chan $+ ! U Will Be Ban next time
.msg $chan Profanity Not Allowed $nick Plz Stop With It!
writeini protection.ini $nick swear true
.timer 1 30 /remini protection.ini $nick swear
halt
}
else {
auser swear $address($nick,1) :swearing $nick $adate $time
access # add deny *! $+ $$ial($nick $+ *,1).addr 15 $Nick swear
kick # $nick Profanity Not Allowed! ban 15 min | halt
}
:test {
.msg $nick ( $nick ) we need to set the example plz $nick }
}
}
on *:ACTION:*:#: {
if ($me !isop $chan) halt
if (($istok($1-,fark,32) == $true) || ($istok($1-,BITCH,32) == $true)) || (($istok($1-,@#$,32) == $true)) || (($istok($1-,pussy,32) == $true)) || (($istok($1-,wanker,32) == $true)) || (($istok($1-,cock,32) == $true)) || (($istok($1-,black,32) == $true)) {
if ($nick isowner $chan) goto test
if ($nick isop $chan) goto test
if ($readini(protection.ini, $nick, swear) != true) {
.msg $nick ( $nick ) Please do not swear on $chan $+ ! U will be band next time
.msg $chan Profanity Not Allowed $nick Plz stop with it!
writeini protection.ini $nick swear true
.timer 1 30 /remini protection.ini $nick swear
halt
}
else {
auser swear $address($nick,1) :swearing $nick $adate $time
access # add deny *! $+ $$ial($nick $+ *,1).addr 15 $Nick swear
kick # $nick Profanity Not Allowed! ban 15 min | halt
}
:test {
.msg $nick ( $nick ) we need to set the example plz $nick }
}
}
on swear:join:#:{
if $me isop $chan { msg $chan welcome back $nick , you was removed for swearing, plz dont let it happen again Ty. | ruser swear $address($nick,1) }
}
#swear end


this oe is mine Enjoy
Jethro_
Comments: 436
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 5, 2009 4:20 am
napa182, it's been awhile, how have you been?

Oh, I totally forgot about the \b anchor. You can use it to match word separately as it is:
Code:
/(\bblack\b|\bpussy\b)/iS
Quote:
<Jethro_> Once you go black you never go back!
* You were kicked by Bot (:no racial slur!)
jonesy44
Comments: 1,856
 
mIRC Snippet:  $regex Swear Kicker
Posted on Sep 5, 2009 3:19 pm
LOL @

<Jethro_> Once you go black you never go back!
* You were kicked by Bot (:no racial slur!)
TheProdigY
Comments: 14
 
mIRC Snippet:  $regex Swear Kicker
Posted on Oct 4, 2009 9:53 pm
Also for an on ACTION just add below the on TEXT...

Code:

on @*:ACTION:*:#: {
  var %cuss = 1, %swear = $me @#$ black nigga negro niggah n1gger kike !@#$ !@#$ !@#$ SyracuseChat
  while ($gettok(%swear,%cuss,32)) {
    if ($findtok($strip($1-),$v1,1,32)) {
      kick $chan $nick Please don't use that kind of language here.
    }
    inc %cuss
  }
}
Jethro_
Comments: 436
 
mIRC Snippet:  $regex Swear Kicker
Posted on Oct 5, 2009 12:33 am
TheProdigY, I'll recommend this:
Code:
on @*:TEXT:*:#:$cuss($1-)
on @*:ACTION:*:#:$cuss($1-)
on @*:NOTICE:*:#:$cuss($1-)
alias -l cuss {
  tokenize 32 $strip($1-)
  var %cuss = 1, %swear = $me @#$ black nigga negro niggah n1gger kike !@#$ !@#$ !@#$ SyracuseChat
  while ($gettok(%swear,%cuss,32)) {
    if ($findtok($1-,$v1,1,32)) {
      kick $chan $nick Please don't use that kind of language here.
    }
    inc %cuss
  }
}
This way you cover the text, action and notice event together.
jonesy44
Comments: 1,856
 
mIRC Snippet:  $regex Swear Kicker
Posted on Oct 5, 2009 1:59 pm
Jethro_: Would be more "correct" to use /cuss $1- as opposed to $cuss() since $indets generally mean returns and /cmds obviously are commands. imo.
gooshie
Comments: 66
 
mIRC Snippet:  $regex Swear Kicker
Posted on Oct 5, 2009 2:44 pm
Code:
$regex($1-,/^(\bwordA\b|\bwordB\b|\bwordC\b)$/giS)


is functionally equivalent to:

Code:
$regex($1-,/^(wordA|wordB|wordC)$/iS)


Both the above expressions match only on wordA OR wordB OR wordC. If any other text preceeds or follows the word it will not match. Even if more exact matches are part of the string. The \b word boundary is unnecessary because with ^ it must begin with wordA OR wordB OR wordC and with $ it must also end with it. The g switch is unnecessary because it can only match a single word anyway. Of course the i switch ignores case and the S switch strips mIRC control codes. Also for a 'swear kicker' the g switch is not really needed because if it matches it does not need to continue searching and go ahead and kick.

http://xkcd.com/208/

Try this for testing purposes:

Code:
; usage: /rx wordA wordc blahwordBlah
alias rx {
  linesep
  if $regex($1-,/^(\bwordA\b|\bwordB\b|\bwordC\b)$/giS) { echo -a original: $1- }
  if $regex($1-,/^(wordA|wordB|wordC)$/iS) { echo -a exact match: $1- }
  if $regex($1-,/(\bwordA\b|\bwordB\b|\bwordC\b)/giS) {
    var %i 1,%r
    while $regml(%i) {
      %r = %r $v1
      inc %i
    }
    echo -a word match: %r
  }
  if $regex($1-,/(wordA|wordB|wordC)/giS) {
    var %i 1,%r
    while $regml(%i) {
      %r = %r $v1
      inc %i
    }
    echo -a string match: %r
  }
  linesep
}
Jethro_
Comments: 436
 
mIRC Snippet:  $regex Swear Kicker
Posted on Oct 6, 2009 12:37 am
Yeah I don't know why miniCruzer placed \b and $ at the same time, including the g flag, which is needless. You only have to choose to use \b or $ to get the job done.

Gee, thanks gooshie. Much appreciated for the code!
TheImrac
Comments: 64
 
mIRC Snippet:  $regex Swear Kicker
Posted on Oct 6, 2009 7:56 pm
I personally like something along the lines of:
Code:
alias swtest {
  If ($hfind(swear,$1-,0,R)) {
    echo -b OMG you swore!!!
  }
}
alias swadd { hadd -m swear $+(/\b,$1,\b/iS) }


/swadd lamers?
/swtest omg you are a lamer!
/swtest No swears in this one...
Jethro_
Comments: 436
 
mIRC Snippet:  $regex Swear Kicker
Posted on Oct 7, 2009 12:20 am
Gee, another eye-opener. Thanks.

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom