Your if statement has four regexp command substitutions, all of which
will always be executed. All four have side effects which change the
values of dummy, p, and ver. When your MSIE regexp matches, your Mozilla
regexp will usually also match. You don't know whether Tcl will execute
your Mozilla regexp command first or second. If it executes the Mozilla
regexp command second, then p will be "Mozilla" even when it's executing
the IE code block. The order in which it executes the commands might
change between different versions of Tcl.
Try putting braces around the [regexp ...] commands. E.g.
if {[regexp -- {(Opera).([0-9\.]{1,})} $browser dummy p ver ]} {
puts "Opera Detected: $p $ver"
} elseif {[ regexp -- {(MSIE).([0-9.]{1,})} $browser dummy p ver ]} {
puts "IE Detected: $p $ver"
} elseif {[regexp -- {(Mozilla)\/([0-9\.]{1,})} $browser dummy p ver ]} {
puts "Mozilla Detected: $p $ver"
if { ($ver < 5 ) || [regexp -- Netscape $browser]} {
set p Netscape
}
} elseif {[regexp -- {(\w+)\/([0-9\.]{1,})} $browser dummy p ver]} { }
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of
your email blank.