mIRC Home    About    Download    Register    News    Help

Print Thread
$regex / $regml url logging. #155842 09/08/06 07:26 PM
Joined: Feb 2006
Posts: 164
V
vexed Offline OP
Vogon poet
OP Offline
Vogon poet
V
Joined: Feb 2006
Posts: 164
Ok i have this to log urls pasted in a channel, then realised that if the same url is pasted twice it still logs it, then i end up with a huge text file.
Can anyone help me so that it if a url matches one already in the text file (Matches every single character) It skips it?

Code:
on ^1:TEXT:*:#: { 
  var %input = $1-
  var %url $regml($regex(%input,/((?:ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*)/g))
  if ( $regml($regex(%input,/((?:ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*)/g)) && ( ($len(%url) > 51) )  ) { /tinyurl $regml($regex(%input,/((?:ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*)/g))
    write system\url.txt $regml(1)  
    echo -a $bit Url logged:00 $regml(1)  
    haltdef
  }
}


Thanks in advance.

Re: $regex / $regml url logging. #155843 09/08/06 11:39 PM
Joined: Feb 2005
Posts: 342
R
Rand Offline
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Code:
if ($read(system\url.txt,w,$regml(1)) == $null) { write system\url.txt $regml(1) }

Re: $regex / $regml url logging. #155844 10/08/06 12:33 PM
Joined: Feb 2006
Posts: 164
V
vexed Offline OP
Vogon poet
OP Offline
Vogon poet
V
Joined: Feb 2006
Posts: 164
Excellent, thanks for that! smile