URL with highlighted text

By Scarecrow on Aug 01, 2017

Usage: $d.url(text text text https://www.google.it/ text)
Return: alt text

alias d.url {
  var %:text = $1-
  if ($regex(%:text,/(\b(www.?\.|https?:\/\/|ftp:\/\/).)/i)) {
    var %a = 1
    while (%a <= $numtok(%:text,32)) {
      if ($regex($gettok(%:text,%a,32),/(\b(www.?\.|https?:\/\/|ftp:\/\/).)/i)) {
        var %b = $+($chr(3),12,$chr(31),$gettok(%:text,%a,32),$chr(31),$chr(3))
        var %:text = $puttok(%:text,%b,%a,32)
      }
      inc %a
    }
  }
  return %:text
}

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.