Tk Library Source Code

View Ticket
Login
Ticket UUID: 709123
Title: ::csv::split with | as separator
Type: Bug Version: None
Submitter: jhonan Created on: 2003-03-25 00:51:32
Subsystem: csv Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-04-01 05:39:33
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2003-03-31 22:39:33
Description:
I am trying to use ::csv::split2matrix with | as the
separator char.

set trec "REC|DPI|AD1|AD2|AD3"
set sepchar "|"
set line [::csv::split $trec $sepchar]
puts $line

- -----> {"} {} {"REC} DPI AD1 AD2 AD3

set trec "REC,DPI,AD1,AD2,AD3"
set sepchar ","
set line [::csv::split $trec $sepchar]
puts $line

- -----> REC DPI AD1 AD2 AD3
User Comments: andreas_kupries added on 2003-04-01 05:39:33:
Logged In: YES 
user_id=75003

I found the reason for the behaviour. csv::split internally uses 
regular expressions for its parsing, and | is a special 
character for the regex engine. So is + for example, or *. 
These characters fail too (extended the testsuite and tried 
many separator characters). The sep char has to be 
protected from special interpretation.

Fixed in CVS head.