I would modify your current script a little bit like so:
set wordlist { Its A Very Good Day! Isn't It }
set newlistlower [list]
foreach word [regexp -inline -all -- {\W+|\w+} $wordlist] {
set newlower [string tolower $word 0 0]
lappend newlistlower $newlower
}
puts [join $newlistlower ""]
[regexp -inline -all -- {\W+|\w+} $wordlist]
splits the string into word and non-word characters, which means you get to keep spaces and punctuations and so on.
foreach
allows you to get each word (spaces get into the loop as well, but string tolower
won't be affecting them).
This will also work on strings such as:
set wordlist {Its A Very Good Day! Isn't It--RIGHT }
to give:
{its a very good day! isn't it--rIGHT }
(Braces put to show that the trailing space on the right is kept)