[expect] strange error (re)

S

Sektor van Skijlen

couldn't compile regular expression pattern: quantifier operand invalid
while executing
"expect -nobrace >|#S {} -re {*
} { lappend response_line $expect_out(buffer); exp_continue }"
invoked from within
"expect {
{>|#S} {}
-re "*\n" { lappend response_line $expect_out(buffer); exp_continue }
}"


The fragment of source code, which invokes this error:

set response_line {}

expect {
{>|#S} {}
-re "*\n" { lappend response_line $expect_out(buffer); exp_continue }
}

What I wanted to do is:

If ">|#S" received, stop reading. Otherwise append read line to the
response_line list and continue reading.

I can read the "end of response" in two ways: one of them is the string
above, another is a line, which looks as follows (the response also begins
from this string):
------ |-------------------------------------

(it is not constant the number of the first dashes - it depends on "something")

A very strange thing is that, when I had such pattern:
{-+ \|-+}

It matches the beginning of the response, then the cited above code is
executed. When there was {-+ \|-+} in the first expect's rule, the error
message was the same.

Or maybe somebody knows more appropriate way to do this?


--
1 6 1 7 4 4 2 548 g4bc7a4 66z 3xt7w v1y z9p1 120 32
(( Michal "Sektor" Malecki w4 66 64 73 7564 24 5 v 34 4
)) ektor van Skijlen 1 5 5 1 844 a v r z 4
Software engineer, Motorola GSG Poland 1 2 2a 1 4
WARNING: Opinions presented by me on usenet groups are my personal opinions
ONLY and are not connected to the employer.
 
T

Thomas Matthews

Sektor said:
couldn't compile regular expression pattern: quantifier operand invalid
while executing
"expect -nobrace >|#S {} -re {*
} { lappend response_line $expect_out(buffer); exp_continue }"
invoked from within
"expect {
{>|#S} {}
-re "*\n" { lappend response_line $expect_out(buffer); exp_continue }
}"
Are you sure you are posting to the correct newsgroup?
I couldn't find these identifiers in the _standard_ C++ specification:
expect
lappend
response_line
$
expect_out
exp_continue

Remember, this newsgroup, discusses the
C++ language, not the C language and not the C# language.

Please read the welcome.txt and FAQs below.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top