URL colorer

By FLCL on Oct 26, 2007

Snippet colours urls in a string of text red.

/*
    This url colorer covers active queries and channels. It will colour the url in the string of text red.

    ; Shoutouts:
        - DarthReven - I was browsing hawkee for url snippets and looked at one particular snippet. DarthReven posted an alias to detect the urls through $regex and $regml. I am currently learning & scripting in regex and decided to experiment with $regml. So I explored this alias a bit further and ended up modifying it. All in all, the original creator of the renamed urlget alias is DarthReven with slight modifications by me. Now understand $regml and $wildtok a lot more. ;)
*/

alias -l u3 { 
  if ($regex($1-,/([http|www|com|net|org])/gi)) { 
    return $replace($1-,$wildtok($1-,$+(*,$regml(1),*),1,32),$+(4,$wildtok($1-,$+(*,$regml(1),*),1,32),)) 
  } 
  else { return $1- }
}

on ^*:text:*:*:{ .echo $iif($chan,$v1 $timestamp $+(<,$iif($left($nick(#,$nick).pnick,1) != $left($nick,1),$+($v1,$nick), $timestamp $nick),>),$nick $+(<,$nick,>)) $u3($1-) | haltdef }

/*

    URL colorer by FLCL
        Any edits/redistributions of this script is prohibited.
        Thanks to DarthReven for the idea of $u3. ^_^
    - Initial release: 10/26/07
*/

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.