

Task

   match a string against a regular expression
   substitute part of a string using a regular expression


set theString "I am a string"
if {[regexp -- {string$} $theString]} {
    puts "Ends with 'string'"
}
 
if {![regexp -- {^You} $theString]} {
    puts "Does not start with 'You'"
}