title: How to use regexp in TCL to match a line from a file?
body: <p>I am new to TCL. So I am asked to extract the start date from a file but I tried and there is no output. Please help.</p>
  
  <p>From my file,there is this line i want to extract the start date: </p>
  
  <pre><code>Running final_step.step_done at: Wed Oct 11 02:04:03 MYT 2017
  </code></pre>
  
  <p>My code: </p>
  
  <pre><code>proc extract_data {} {
      ## To extract startdate 
      set file [open files/stages.files]
      while {[gets $file line] &gt;= 0} {
          if {[regexp {^Running (\S+\s)at: (\S+.*)$} $line match Stage StartDate]} {
              if {[regexp "[$CURRENT_STAGE]\.step_done" $Stage]} {
                  #set stage $Stage
                                  set end_date $StartDate
                  set print_end_date [regsub -all " " $StartDate "_"]
                                  #echo "2) $stage - $end_date"
              } elseif {[regexp "^[$CURRENT_STAGE] " $Stage]} {
                  #set stage $Stage
                  set start_date $StartDate
                  set print_start_date [regsub -all " " $StartDate "_"]
                  #echo "1) $stage - $start_date"
              }
          }
      }
  </code></pre>
  
  <p>Is there something wrong with my regexp?</p>