Expect regex number pattern
Had a quick look at expect's documentation:
However, because expect is not line oriented, these characters match the beginning and end of the data (as opposed to lines) currently in the expect matching buffer.
Your regex should take into account the fact that you have line breaks.
If your data is 0\n
, then you can use "^0\n$"
.