Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 86e42145a1983c48c59504984ea510954dd8360c
Ticket: 1490503fffffffffffffffffffffffffffffffff
regexp within foreach loop matches wrong
User & Date: msofer on 2006-05-18 03:59:37
Changes

  1. assignee changed to: "msofer"
  2. closedate changed to: "2006-05-17T20:59:37"
  3. closer changed to: "msofer"
  4. icomment:
    Logged In: YES 
    user_id=148712
    
    The bug is actually in Tcl8.3 (although I did not confirm
    the behaviour there), the behaviour in 8.4 is correct.
    
    Your script is missing some braces in order to perform
    according to your expectation: it should be
    
      if {[regexp ...]} {
          send_user ">KEY $key VALUE $value\n"
      } elseif {[regexp ...] {
          send_user "KEY2 $key VALUE $value\n"
      }
    
    Please note that the conditions to 'if ... elseif' are
    enclosed in braces. This means that they are passed to 'if'
    as strings; when 'if' evals the first condition and finds it
    is true, it never evaluates the second.
    
    In your script as posted, both regexp's are evaluated
    *before* they are passed as arguments to 'if'; so, even when
    the first regexp matches, the values $key and $value are set
    by the second regexp.
    
    
  5. login: "msofer"
  6. mimetype: "text/plain"
  7. resolution changed to: "Invalid"
  8. status changed to: "Closed"
  9. username: "msofer"