mIRC Homepage
Posted By: vexed $regex / $regml url logging. - 09/08/06 07:26 PM
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.
Posted By: Rand Re: $regex / $regml url logging. - 09/08/06 11:39 PM
Code:
if ($read(system\url.txt,w,$regml(1)) == $null) { write system\url.txt $regml(1) }
Posted By: vexed Re: $regex / $regml url logging. - 10/08/06 12:33 PM
Excellent, thanks for that! smile
© mIRC Discussion Forums