Skip to content
Tcl Source Code History Of Ticket 787339ffffffffff
Login

History Of Ticket 787339ffffffffff

Artifacts Associated With Ticket 787339ffffffffff

  1. Ticket change [e9d1c66faa] (rid 104872) by nobody on 2003-08-12 11:21:42:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized 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 initialized to: "obsolete: 8.4.4"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "18. Commands M-Z"
    10. title initialized to: "string match failure with meta-characters"
    11. type initialized to: "Bug"
  2. Ticket change [ac36cf351b] (rid 101253) by dkf on 2003-08-12 20:31:10:

    1. closedate changed to: "2003-08-12T13:31:10"
    2. closer changed to: "dkf"
    3. icomment:
      Logged In: YES 
      user_id=79902
      
      You're getting caught out by the standard Tcl quoting rules
      which always apply.  Try:
        string match {\*} $yourString
      instead of:
        string match "\*" $yourString
      though the following should work too:
        string match "\\*" $yourString
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. resolution changed to: "Invalid"
    7. status changed to: "Closed"
    8. username: "dkf"