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
}
}