mIRC Home    About    Download    Register    News    Help

Print Thread
R
R00bie
R00bie
R
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

C
CitizenKane
CitizenKane
C
Like this?
Code:
/var %strip = $strip(%variable)
if ((-??- iswm %strip) && (-aa- !iswm %strip) && .... && (-cc- !iswm %strip)) goto end

R
R00bie
R00bie
R
Hmm.. but

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

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

C
CitizenKane
CitizenKane
C
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.
R
R00bie
R00bie
R
Great... seems to be working. And i love the idea of iswm && !iswm.

Thank you smile

R
R00bie
R00bie
R
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,630
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,630
You're missing a ) at the end. I don't see why you got an /elseif error for an /if though.

R
R00bie
R00bie
R
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

S
schaefer31
schaefer31
S
$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