mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2013
Posts: 33
F
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Aug 2013
Posts: 33
I have greatly improved in mSL code and I'm glad I can say I can do a lot with mIRC's script editor, but I'm still far away from a pro.

Hence I'm going to give a go at something I found in my old files: "Don't look", and I understand why I named it that. There's a variable that I somewhat understand, but I continue to have problems.

It's about these combined variables:
Code:
    var %domain com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk
    var %link /(?<=^|\s)((?>\S{3,8}:\/\/|w{3}\56)\S+)|\56( $+ %domain $+ )\b/iS 

I mean the second variable here, and I'd would like to start by asking: Why are none of these characters in the mIRC help file(besides: "$+", "<=", "^", "<", ">", "/", "|") and how do I "debug" this code I found?

All help would be greatly appreciated.

greetings,
Farcrada

Last edited by Farcrada; 15/11/14 05:17 PM.
Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
I'm not 100% what you are asking, but are you confused about how a regular expression works?

Joined: Aug 2013
Posts: 33
F
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Aug 2013
Posts: 33
Haha! That might very well be the case.
Though, I cannot phantom how this would link to regular expressions...

Code:
if ($regex($1-,%link)) {

Would this have something to do with it...?

Last edited by Farcrada; 15/11/14 05:32 PM.
Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
..ya, it would have something to do with it.

http://www.mircscripts.org/showdoc.php?type=tutorial&id=989

Joined: Aug 2013
Posts: 33
F
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Aug 2013
Posts: 33
So. If I've understood the tutorial (Which was VERY helpful if I'm correct. xD), this is what
Code:
    var %domain com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk
    var %link /(?<=^|\s)((?>\S{3,8}:\/\/|w{3}\56)\S+)|\56( $+ %domain $+ )\b/iS

should be:

%link starts with either a character which does not have to be there, but if it is, it must be at least once (Which would make it the same as the "+" operator. Do not completely understand it's use.) and that has to be smaller or equal to the value of "^" which will be 1 if the rest of the variable returns a match, or it must match a space bar character.

That's the starting, now for the
Code:
(?>\S{3,8}:\/\/|w{3}\56)

part:

As long as "?" returns more than it matches 3 to 8 non space characters with the string: "://" OR if it returns 3 times the character "w". Though... I have no clue what "\56" means.
Then comes this:
Code:
\S+)

Which means that this matches a character that is non-space. Then a character in the string that matches the substring and it must occur it least once but can occur more then once(Redundant much?)... Then it closes that grouping of code.

OR:
Code:
|

it must match I have no clue what "\56" means. any from the %domain variable. But... I'm missing a "\b". Unless that would be "\56".

And this all in lower case ? and as a non space single line. ?

On a scale from 1 to 10... How bad did I do?


Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
You can escape characters in octal by \ or in hex by \x, \56 corresponds to the "." character.

Joined: Aug 2013
Posts: 33
F
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Aug 2013
Posts: 33
So I take it I had everything correct besides the "\."?


Link Copied to Clipboard