TCL expect regular expression
Use this:
expect -re {[$#] }
The keys to this are: add the -re
flag so that we can match an RE, and put the RE in {braces}
so that it doesn't get substituted.
A more generic solution:
set prompt "(%|#|\\\$) $"
expect -re $prompt
This one matches %, # and $.
The second dollar sign ensures matching the pattern only at the end of input.