mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2006
Posts: 8
R
R00bie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Aug 2006
Posts: 8
Hi,

Need help with sth like that:

i have a variable set and now i need to check the variable for presence of a -??- where ?? are any two letters (not digits) between - - and if found { goto end } . But also i need few of -??- to be excluded from this rule. So basicly:

if -??- iswm $strip(%variable)) { goto end } but if -aa- or -bb- or -cc- is found procede with a script.

I can't do if -aa- | -bb- | -cc- !iswm $strip(%variable)) { goto end } coz the -??- might be in variable but doesn't have to. Sound easy but somehow i can't get it to work smirk

Joined: Mar 2006
Posts: 47
C
Ameglian cow
Offline
Ameglian cow
C
Joined: Mar 2006
Posts: 47
Like this?
Code:
/var %strip = $strip(%variable)
if ((-??- iswm %strip) && (-aa- !iswm %strip) && .... && (-cc- !iswm %strip)) goto end

Joined: Aug 2006
Posts: 8
R
R00bie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Aug 2006
Posts: 8
Hmm.. but

if ((-??- iswm %strip)....

would also match -66- in that case, and any -digitdigit- shouldnt execute { goto end }. Or am i wrong? confused

Joined: Mar 2006
Posts: 47
C
Ameglian cow
Offline
Ameglian cow
C
Joined: Mar 2006
Posts: 47
Oh, sorry, misread your question. You might want to use a $regex type expresssion here. My experience here is limited, but I think this works:

Code:
 if (($regex(%strip,-[a-zA-Z][a-zA-Z]-) && (-aa- !iswm %strip)... ) 

Last edited by CitizenKane; 12/08/06 05:44 PM.
Joined: Aug 2006
Posts: 8
R
R00bie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Aug 2006
Posts: 8
Great... seems to be working. And i love the idea of iswm && !iswm.

Thank you smile

Joined: Aug 2006
Posts: 8
R
R00bie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Aug 2006
Posts: 8
Hmmz, it didn't work
I had to modify it a bit so it fits my %variable and ended with this:

if (($regex(%variable,-[a-zA-Z][a-zA-Z]-) && (-AA- !iswm $strip(%variable)) && (-BB- !iswm $strip(%variable)) && (-CC- !iswm $strip(%variable)) && (-DD- !iswm $strip(%variable)) { goto end }

And mIRC returns me that:
* /elseif: invalid format (line 9, testo.mrc) [line 9 is the one above]

Anyone has some ideas what have i done wrong?

Please help confused

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
You're missing a ) at the end. I don't see why you got an /elseif error for an /if though.

Joined: Aug 2006
Posts: 8
R
R00bie Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Aug 2006
Posts: 8
OMG how hard can it be to count '(' ')' grin
LOLZ @ me

Dunno why /elsif error i've pasted whole line and not a single char is missing

Anyways /elsif error fixed and i just hope now it will catch nicely what i want and reject the rest smile

BIG THX to all those who helped smile

Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
$regex(%strip,-[a-zA-Z][a-zA-Z]-) will work, but you're missing delimiters (//) and it can be shortened to $regex(%strip,/-[a-z]{2}-/i)

The i modifier is used to specify a case insensitive match.


Link Copied to Clipboard