Badword Regex Creator

By LIQUID_NiTrO on Oct 22, 2007

This simple alias is intended for the quick creation of otherwise tedious regexes used primarily in badword filter snippets.
What this alias does is take a simple English word and generate a regex that will match that word as well as ANY "l33t"-ified version of it.
This is intended to counteract attempts by users to bypass badword filters. So if you want to censor the word "foobar", using this snippet will allow you to quickly filter "f00b4r", "foo|3a|2", and any other possible combinations one could make to circumvent the filter.
Usage: $regexConvert(word)
Returns a regex pattern that will match any l33t-ifications of word.

Example of possible use is included.

alias regexConvert {
  return / $+ $replace($1,a,([a4\@]|\/\-\\),b,(b|\|3),d,(d|\|\ $+ $chr(41) $+ ),e,[e3],h,(h|\|\-\|),i,[i1\!],k,(k|\|\<),l,([l1]|\|_),m,(m|\/\\\/\\),n,(n|\|\\\|),o,[o0],r,(r|\|2),s,[sz5],t,[t7],u,(u|\|_\|),v,(v|\\\/),w,(w|\\\/\\\/),y,[yi],z,[sz],ks,(ks|x)) $+ /i
}
;Begin Example Snippet
alias matches {
  ;Usage: /matches <word> <l33t_word>
  ;Echoes a positive answer if <l33t_word> is a l33t-ified version of  <word>

  ;For example, try using the following commands:
  ;/matches hello h3|_|_0
  ;/matches hello hello
  ;/matches hello |-|3|_l0
  if ( $regex($2,$regexConvert($1)) ) {
    echo -a Match!
  }
  else {
    echo -a No Match
  }
}

Comments

Sign in to comment.
worldwide7477   -  May 14, 2012

please explain more on how to use this.....if im in my channel and a bad word comes around what would be the trigger to get all types of that word to add to the filter ...or how will you start this script in the channel

 Respond  
RubixCube   -  Oct 23, 2007

A good step-up to badword filters. Will be using this frequently. Nice job Liquid.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.