Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3593638
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:36:13+00:00 2026-05-18T19:36:13+00:00

I have an XML file. <?xml version=1.0?> <catalog> <book id=bk101> </book> <catalog> I read

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T19:36:13+00:00Added an answer on May 18, 2026 at 7:36 pm

    The spaces in the RE are significant, and you place them around the original RE where there wouldn’t be any expected. If you want to parse XML though, it might be best to use tdom or TclXML.

    You should check that the result of regexp returns a non-zero answer (meaning it found something), otherwise ‘dummy’ won’t get set, or will remain as was if previously set.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

say, i have such xml file: <?xml version=1.0?> <catalog> <title>My book catalog</title> <link>http://example.com/catalog</link> <book
Following is sample XML File - <?xml version=1.0 encoding=UTF-8?> <Catalog> <Book> <AName>Steven Holzner</AName> <BName>Using
I have this XML at http://localhost/file.xml : <?xml version=1.0 encoding=utf-8?> <val:Root xmlns:val=http://www.hw-group.com/XMLSchema/ste/values.xsd> <Agent> <Version>2.0.3</Version>
I am trying to transform an XML file into an updated version. I have
I have an XML attribute representing the version numbering of a file. The file
I have an XML file that looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1
I have a XML file with the following data format: <net NetName=abc attr1=123 attr2=234
I have following xml file: <?xml version = "1.0" ?> <Employee> <Emp_Id>E-001</Emp_Id> <Emp_Name>Vinod</Emp_Name> <Emp_E-mail>Vinod1@yahoo.com</Emp_E-mail>
I have an option to choose between local based data storing (xml file) or
im novice in XML and XSLT. i have a an xml file ( book.xml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.