I have an XML file.
<?xml version="1.0"?>
<catalog>
<book id="bk101">
</book>
<catalog>
I read the file and store it in file_data
set data [split $file_data "\n"]
foreach line $data {
regexp { book id=\"(.*)\" } $line all dummy
puts $all
puts $dummy
}
So here as you can see I am trying to read the book id and print it out. I get the error dummy not found? Am I do it wrong?
Edit
Weirdly when I try this :
set mydata {<book id="bk101"> testing the code }
puts $mydata
regexp {book id="(.*)"} $mydata all part
puts $all
puts $part
Output
<book id="bk101"> testing the code
book id="bk101"
bk101
Have no idea the code at the top still shows error