Expect (language) "failed to compile regex pattern: quantifier quantifier error is invalid"

I'm having issues with Expect regex.

I am trying to combine this conclusion:

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 "6" from "+6" in a line:

ITPKT.hg0       :                     6                  +6

I use this regex:

ITPKT.*\+(\[0-9])

But I get an error when running 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 read that some characters must be escaped or Expect will try to evaluate then (from here “['escaped above], and I don't get the error“ wrong command ”, so I think we went through this step.

But now I am fixated on why this expression will not compile: - /

Unsuccessful direct answer, does anyone know about Expect regex tools that could help me debug this?

+3
2

, "+"!

:

expect -re "ITPKT.*\\+(\[0-9])" {...}
+4

, , , . , , , regexp "+" " " , , .

"+" . ( , Tcl, "+" .)

+2

Source: https://habr.com/ru/post/1757052/


All Articles