mIRC Home    About    Download    Register    News    Help

Print Thread
#246433 11/06/14 02:57 AM
Joined: Mar 2014
Posts: 65
E
Exuviax Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Mar 2014
Posts: 65
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?


I do things with stuff that makes other things do stuff.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
use $regex()
Code:
if $regex($1-,/(symbol){10,}/Sig) { do stuff }

Joined: Mar 2014
Posts: 65
E
Exuviax Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Mar 2014
Posts: 65
I can't seem to get this command to pick up symbols smirk


I do things with stuff that makes other things do stuff.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
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

Last edited by Loki12583; 13/06/14 08:51 PM.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
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


Link Copied to Clipboard