Well, I'm still learning regex, so I'm certain this can be improved greatly. But it works...
alias urlc {
noop $regex($1-,/((\d{1,2})|)(?!.*(\d{1,2}|).*(?:((?:(?:unreal|ftp|https?):\/\/|www\.)\S+))).*(?:((?:(?:unreal|ftp|https?):\/\/|www\.)\S+))/gi)
var %c = $regml(1)
return $regsubex($1-,/((?:(?:unreal|ftp|https?):\/\/|www\.)\S+)/gi,$+($clr($urlco),$chr(31),\t,$chr(31),%c))
}
This should work fine regardless how many colors are used or where they are used (before or after the URL). It also works if Ctrl-O is used. *However*, it doesn't handle multiple URLs if there is a color change between them (it does work if there isn't a color change anywhere between the URLs). It will also not work if Ctrl-K is used by itself instead of using Ctrl-O, or if background colors are used with Ctrl-K.
I'm sure this can be improved and those issues included. I'm just already beyond what I really understand, so this is as far as I can get.