I'm not quite sure what you want, but here is an example:
set str "aaaa bbbb cccc " regexp {(\S+)\s+(\S+)\s+(\S+)} $str -> wordA wordB wordC puts "The first is \"$wordA\", second \"$wordB\", and third \"$wordC\""
What produces this conclusion:
The first is "aaaa", the second is "bbbb" and the third is "cccc"
In RE, \S+ means a non-empty sequence of non-white characters, and \S+ means a non-empty sequence of spaces. I could use \w+ ("words" characters) and \w+ ("non-words" characters) respectively. Brackets in RE READ capture groups; Tcl does not require REs to match the entire input string.
source share