mIRC Homepage
Posted By: Exuviax Symbol Spam Protection - 11/06/14 02:57 AM
Say the person posts any kinda of symbol repeatidly, like ......... or ,,,,, or one of smile smile smile smile smile I want a script that looks at the line, and after 10 symbols, it times them out. But I don't want to do a million

Code:
if (. isin $1-)


Statements, I am looking for something more like

Code:
if (symbol) 


any Ideas?
Posted By: blessing Re: Symbol Spam Protection - 12/06/14 04:57 AM
use $regex()
Code:
if $regex($1-,/(symbol){10,}/Sig) { do stuff }
Posted By: Exuviax Re: Symbol Spam Protection - 13/06/14 07:45 PM
I can't seem to get this command to pick up symbols smirk
Posted By: Loki12583 Re: Symbol Spam Protection - 13/06/14 08:33 PM
Testing the ? character:
Code:
var %regex = /(\?){10,}/Sig
if ($regex($1-,%regex)) { do stuff }


mIRC was interpreting the comma in the regex as a delimter for the $regex identifier, so store it in a variable first.

Many characters have special meanings in regex, so you should escape it with a \ if you're unsure. Some characters that should be escaped: . $ ^ ? [ ] ( ) + *

And unless you come up with rules that lend themselves better to a simpler regex, you're going to either have just as many $regex checks as you would have isin checks or a very long $regex.

"." matches any character, so you can use this to test if any character is repeated 10 times: /(.){10,}/Sig

Other than this I can't think of anything better to test if multiple characters are repeated 10 times individually:

/(\?){10,}|(\+){10,}|(\*){10,}|(\^){10,}/Sig
Posted By: blessing Re: Symbol Spam Protection - 15/06/14 04:52 AM
Originally Posted By: Loki12583
Testing the ? character:
Code:
var %regex = /(\?){10,}/Sig
if ($regex($1-,%regex)) { do stuff }


mIRC was interpreting the comma in the regex as a delimter for the $regex identifier, so store it in a variable first.

Aye, my bad. Thanks Loki for correcting. wink
© mIRC Discussion Forums