I'm having trouble with an Expect regular expression.
I'm trying to match on this output:
RUC.hg0 : 6 +6
ITPOK.hg0 : 6 +6
ITUC.hg0 : 6 +6
ITPKT.hg0 : 6 +6
IT127.hg0 : 6 +6
ITBYT.hg0 : 456 +456
IR127.hg0 : 6 +6
IRPKT.hg0 : 6 +6
IRUC.hg0 : 6 +6
IRPOK.hg0 : 6 +6
IRBYT.hg0 : 456 +456
IRJUNK.hg0 : 1 +1
I want to pull out the '6' from the '+6' in the line:
ITPKT.hg0 : 6 +6
I'm using this regular expression:
ITPKT.*\+(\[0-9])
But I'm getting an error when I run the script:
couldn't compile regular expression pattern: quantifier operand invalid
while executing
"expect -re "ITPKT.*\+(\[0-9])" {
puts "$expect_out(1, string)";
set snt $expect_out(1, string);
set sent 1;
}"
I've read that certain characters need to be escaped or Expect will try to evaluate then (hence the '[' being escaped above), and I'm not getting the 'invalid command' error, so I think I've got past that stage.
But now I'm stuck on why this expression won't compile :-/
Failing a direct answer, does anyone know of any Expect regex tools that might help me debug this?