stratusmark
Programmer
Hi,
I am trying some regexp, but so far without major success... The thing I want to achieve is the following: having a string:
"-------------------------- some string ----------------------"
I want to check if the string-in-question contains three parts (i.e. heading dashes, then some text and then ending dashes) and if yes, then have the text passed in specific variable, i.e. procedure which returns 1 if string that is passed to it match this regexp and (as second argument) the content of the comment (in the above example 'some string'.
Can you please advise how to achieve this goal ? I tried with something like:
set testString "--------------- check the wheels ----------------"
regexp -- {(-*)(([a-zA-Z0-9]+ )+)(-*)} $testString result dashes1 ans dashes2
puts $result
but that does not work and I cannot split original string into these three sections.
Thanks, Mark
I am trying some regexp, but so far without major success... The thing I want to achieve is the following: having a string:
"-------------------------- some string ----------------------"
I want to check if the string-in-question contains three parts (i.e. heading dashes, then some text and then ending dashes) and if yes, then have the text passed in specific variable, i.e. procedure which returns 1 if string that is passed to it match this regexp and (as second argument) the content of the comment (in the above example 'some string'.
Can you please advise how to achieve this goal ? I tried with something like:
set testString "--------------- check the wheels ----------------"
regexp -- {(-*)(([a-zA-Z0-9]+ )+)(-*)} $testString result dashes1 ans dashes2
puts $result
but that does not work and I cannot split original string into these three sections.
Thanks, Mark