title: How can I assign a variable using $expect_out in TCL/EXPECT?
body: <p>If I want to match <code>DEF_23</code> using the following regexp:</p>
  
  <pre><code>expect {
      -re "DEF_\[0-9]*"
      set result $expect_out(1,string)
  }
  </code></pre>
  
  <p>why does it say <code>no such element in array</code>?
  How does <code>$expect_out</code> work, and how can I capture the <code>DEF</code> using a regexp and assign it to the variable <code>result</code>?</p>