# HG changeset patch # User Matti Hamalainen # Date 1612352230 -7200 # Node ID 40db544279503fe058e1c58048490d99637549a2 # Parent 6997201c7b713178f194afd5084e6f129ddf41bf urllog: Clean up regexp statements. diff -r 6997201c7b71 -r 40db54427950 urllog.tcl --- a/urllog.tcl Wed Feb 03 13:36:43 2021 +0200 +++ b/urllog.tcl Wed Feb 03 13:37:10 2021 +0200 @@ -276,11 +276,11 @@ upvar $urlMHostName urlHostName ### Hack for removing parenthesis around an URL - if {[regexp {^\((.+)\)$} $urlStr urlMatch urlClean]} { + if {[regexp {^\((.+)\)$} $urlStr -> urlClean]} { set urlStr $urlClean } - if {[regexp {^\[(.+)\]$} $urlStr urlMatch urlClean]} { + if {[regexp {^\[(.+)\]$} $urlStr -> urlClean]} { set urlStr $urlClean } @@ -295,7 +295,7 @@ } ### Handle URLs that have an IPv4-address - if {[regexp "(\[a-z\]+)://(\[0-9\]{1,3})\\.(\[0-9\]{1,3})\\.(\[0-9\]{1,3})\\.(\[0-9\]{1,3})" $urlStr urlMatch urlProto ni1 ni2 ni3 ni4]} { + if {[regexp "(\[a-z\]+)://(\[0-9\]{1,3})\\.(\[0-9\]{1,3})\\.(\[0-9\]{1,3})\\.(\[0-9\]{1,3})" $urlStr -> urlProto ni1 ni2 ni3 ni4]} { # Check if the IP is on local network if {$ni1 == 127 || $ni1 == 10 || ($ni1 == 192 && $ni2 == 168)} { urllog_verb_msg 1 $urlNick $urlChan "err_url_local_net" [list $urlStr] @@ -323,7 +323,7 @@ ### Get URL protocol component set urlProto "" - if {[regexp "(\[a-z\]+)://" $urlStr urlMatch urlProto]} { + if {[regexp "(\[a-z\]+)://" $urlStr -> urlProto]} { ### Is it a http or ftp url? if {$urlProto != "http" && $urlProto != "https" && $urlProto != "ftp"} { urllog_verb_msg 1 $urlNick $urlChan "err_url_proto_class" [list $urlStr $urlProto] @@ -457,13 +457,13 @@ set uencoding "" # Get information about specified character encodings - if {[info exists umeta(content-type)] && [regexp -nocase {charset\s*=\s*([a-z0-9._-]+)} $umeta(content-type) umatches uenc_http]} { + if {[info exists umeta(content-type)] && [regexp -nocase {charset\s*=\s*([a-z0-9._-]+)} $umeta(content-type) -> uenc_http]} { # Found character set encoding information in HTTP headers } - if {[regexp -nocase -- "" $udata umatches uenc_doc]} { + if {[regexp -nocase -- "" $udata -> uenc_doc]} { # Found old style HTML meta tag with character set information - } elseif {[regexp -nocase -- "" $udata umatches uenc_doc]} { + } elseif {[regexp -nocase -- "" $udata -> uenc_doc]} { # Found HTML5 style meta tag with character set information } @@ -486,15 +486,15 @@ # Get the document title, if any set urlTitle "" - if {[regexp -nocase -- "" $udata umatches urlTitle]} { + if {[regexp -nocase -- "" $udata -> urlTitle]} { # ... - } elseif {[regexp -nocase -- "(.\*\?)" $udata umatches urlTitle]} { + } elseif {[regexp -nocase -- "(.\*\?)" $udata -> urlTitle]} { # ... } # If facebook, get meta info if {[regexp -nocase -- "(http|https):\/\/www.facebook.com" $urlStr]} { - if {[regexp -nocase -- " urlTmp]} { if {$urlTitle != ""} { append urlTitle " :: " } append urlTitle $urlTmp }