Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e9d1c66faa8d4a63a652a41de647479a01d43eec
Ticket: 787339ffffffffffffffffffffffffffffffffff
string match failure with meta-characters
User & Date: nobody on 2003-08-12 11:21:42
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    string match fails if pattern contains the meta-chars *, 
    \ , [, ] or ?, even using backslash in pattern (as man 
    page states).
    * and ? meta  chars are always interpreted as meta, 
    even if backslashed.
    The remaining ones are never matched.
    
    Reproducible bug:
    
    string match "\*" "sjdjshddsdsj"
    gives 1
    
    set a "jashjdhasjd\\"
    string match "\\" $a
    gives 0
    
    Expected result:
    for the first example:
    false, because trailing backslash should force the * to 
    be interpreted as literal.
    
    for the second example:
    true, because $a contains a backslash
    
    How to circumvent:
    use regexp with ascii encoding (braces are mandatory):
    
    regexp {\x02a} "hsajdhds*sadd"
    gives 1
    while
    regexp {\x02a} "hsajdhdssadd"
    gives 0, and so on.
    
    \ = 05c 
    * = 02a
    ? = 03f
    [ = 50b
    ] =  05d
    
    [email protected] 
    
    
  4. foundin changed to: "obsolete: 8.4.4"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "18. Commands M-Z"
  10. title changed to: "string match failure with meta-characters"
  11. type changed to: "Bug"