Check whether string contains fragment in Tcl
<p>I have a set of words, e.g. {6-31G*, 6-311G*, 6-31++G*, 6-311++G**}. As you may see, the common fragment is "6-31". What I need to do in Tcl now is to check whether string under <code>$variable</code> contains this fragment. I know I could do it with regular expression like this:</p>

<pre><code>if {[regexp {^6-31} $variable]} {
  puts "You provided Pople-style basis set"
}
</code></pre>

<p>but what other solution could I use (just out of curiosity)?</p>