Forum Discussion
hooleylist
Sep 25, 2011Cirrostratus
Actually, I was wrong on this. string trim will remove any instances of individual characters--not just the literal string of "www.". So if your host starts with a w that isn't www., you will get an unintended result:
% string trimleft wily.example.com www.
ily.example.com
Here is a more accurate option using scan:
set host [string tolower [HTTP::host]]
if {[scan $host {www.%s} host_no_www] == 1 }{
set host $host_no_www
}
log local0. "\$host: $host"
Aaron