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

  • SEARCH
  • Home
  • 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 7437099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:20:45+00:00 2026-05-29T10:20:45+00:00

I am working on a script to parse a certain fault code out of

  • 0

I am working on a script to parse a certain fault code out of a SOAP message using tcl, and I have finally come to the part where I compare the message to the desired message. As you can see, I am trying to check if the string “9000” is contained in the array element “$soap(Fault)”


if { [ string match *\<FaultCode\>9000\</FaultCode\>* $soap(Fault) ] } {

    # -- Success case

} else {

    # -- fail case

}

In the example I have provided, I have escaped all of the “special characters” in tcl:

&;`'"|*?~<>^()[]{}$\

but is it required? Could one simply do:

*<FaultCode>9000</FaultCode>*  ?

I have looked around pretty thoroughly and haven’t been able to find something quite as precise as what I am asking. I was going to ask in the tcl chat room, but I couldn’t find one!

Thanks

  • 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-29T10:20:47+00:00Added an answer on May 29, 2026 at 10:20 am

    The short answer is that no, you don’t need to escape all those characters. In fact, some of those characters aren’t even special.

    There are two layers here: first, at the tcl parsing level: reading through tcl’s parsing rules, you have a few options:

    • Wrap your argument in double quotes. (but then you have to worry about embedded quotes, [commands], and $variables)
    • Wrap your argument in braces. (but then you have to worry about nesting braces)
    • Use the bare word as you have above (but then you have to worry about leading braces, quotes, whitespace, and everything as for double quotes, above.)

    All of that is just determining what gets passed to [string match] – the second layer involves how [string match] deals with this pattern (it’s not a regex, by the way, it’s just a glob-style pattern). There are only these special characters in tcl’s glob style patterns: *, ?, [], . If you want any of these to be treated as literals, you have to escape them. Anything else is treated as a literal match, so you don’t have to worry about the <>’s, or the /.

    So, this line is fine:

    string match *<FaultCode>9000</FaultCode>* $soap(Fault)
    

    But you could also use these styles to set off the match pattern, stylistically.

    string match "*<FaultCode>9000</FaultCode>*" $soap(Fault)
    string match {*<FaultCode>9000</FaultCode>*} $soap(Fault)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Still working on this part of my script to parse my JSON jsonArray =
I have a script working well for creating ad hoc iPhone builds. I can
So I have my upload script working just fine, but now it's a matter
I'm having little trouble creating a script working with URLs. I'm using urllib.urlopen() to
In tcsh , I have the following script working: #!/bin/tcsh setenv X_ROOT /some/specified/path setenv
I have a python script which should parse a file and produce some output
I've been trying to write a PHP script to parse an XML document using
I have a script that is parsing out fields within email headers that represent
I have a working recommend to script, I just wanted to add a extra
I'm working on a ruby script to grab historical stock prices from Yahoo, using

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.