I am new to Expect and Tcl. I am writing a code using expect in Tcl to match a pattern alone(ie without the pattern being a sub string in a given string).Code is given below:
package require Expect
expect "^hi$" { send "pattern matched" }; # hi is the pattern to be matched
But the code do not detect hi. If the code is modified as below it works when the pattern comes in the first part of the string
package require Expect
expect "^hi" { send "pattern matched" }
If the code is modified as below, it is not working even though it is expected to match the pattern at the end of the string
package require Expect
expect "hi$" { send "pattern matched" }
Am I doing anything wrong? Please help