mIRC Home    About    Download    Register    News    Help

Print Thread
#244500 05/03/14 03:14 AM
Joined: Dec 2013
Posts: 779
N
Nillen Offline OP
Hoopy frood
OP Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Code:
     var %links /(?<=^|\s)((?>\S{3,8}:\/\/|w{3}\56)\S+)|\56( $+ %domains $+ )\b/iS
    if ($regex($1-,%links)) { 

I've been using that code for the longest time. Now, I'm trying to make a whitelist, I was thinking I could use the %links and set a switch on that. But I tried printing the variable by Msg # %links and I obviously get this:
Code:
 /(?<=^|\s)((?>\S{3,8}:\/\/|w{3}\56)\S+)|\56(com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk|se|tv|html|ly)\b/iS 


How would I proceed to single out the link from $1- and print that to a variable instead?


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Aug 2013
Posts: 82
I
Babel fish
Offline
Babel fish
I
Joined: Aug 2013
Posts: 82
$regml(1) will return the part of a string last checked against a regex identifier (such as $regex()) that matches the regex pattern first (if groups are used)

For example, if you have:
Code:
$regex(good morning,/(mor)/Si)


then $regml(1) will return mor

Of course, you will have to use $regml(1) after the $regex($1-,%links)

Joined: Dec 2013
Posts: 779
N
Nillen Offline OP
Hoopy frood
OP Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Ah, thank you kindly good sir. Just what I was looking for smile


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net

Link Copied to Clipboard