Overview
| Artifact ID: | dbbf9774097c64254b94c21ec9dc5ba9cb0e030a |
|---|---|
| Ticket: | 1490503fffffffffffffffffffffffffffffffff
regexp within foreach loop matches wrong |
| User & Date: | sachulka on 2006-05-17 20:30:07 |
Changes
- assignee changed to: "dkf"
- cmimetype changed to: "text/plain"
- comment changed to:
I recently upgraded from Tcl8.3 to Tcl8.4.13 on solaris and discovered this difference which does not seem right. here is my little program: proc send_user { x } { puts $x } set alarmRecord [list "abc: def" "ALARM 1: blah" "ghi: jkl" "ALARM 2: fjdasl"] foreach record $alarmRecord { if [regexp {(ALARM)[^:]+([0-9]+)} $record match key value] { send_user ">KEY $key VALUE $value\n" } elseif [regexp {([^:]+):(.*)} $record match key value] { send_user "KEY2 $key VALUE $value\n" } } Here are the results, the key and value are different for different Tcl versions: sapphire:~/thuyscripts {ewuthle_eusbd00250}> tclsh8.3 KEY2 abc VALUE def >KEY ALARM VALUE 1 KEY2 ghi VALUE jkl >KEY ALARM VALUE 2 sapphire:~/thuyscripts {ewuthle_eusbd00250}> tclsh % info tclversion 8.4 KEY2 abc VALUE def >KEY ALARM 1 VALUE blah KEY2 ghi VALUE jkl >KEY ALARM 2 VALUE fjdasl So if regexp is in the foreach loop and the same variables (key/value) are used inside if - regexp does not match correctly. - foundin changed to: "obsolete: 8.4.13"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "sachulka"
- subsystem changed to: "16. Commands A-H"
- title changed to: "regexp within foreach loop matches wrong"
- type changed to: "Bug"