array set latin { a \[àáâãäåÀÁÂÃÄÅa\] e \[èéêëÈÉÊËe\] i \[ìíîïÌÍÎÏi\] o \[òóôõöÒÓÔÕÖo\] u \[ùúûüÙÚÛÜu\] n \[ñnÑ\] y \[ýÿÝy\] b \[ßb\] } proc textbold {pattern text} { # no pattern no text process if {[join $pattern] == ""} { return $text } # find and avoid duplicities in the pattern array set v {} foreach x [join [join $pattern]] { set v($x) "" } set pattern [array names v] global latin # lets switch spetial chars for the normal one foreach x [array names latin] { regsub -all $latin($x) $pattern $x pattern } # now prepare for re process set pattern [string map [array get latin] $pattern] foreach x $pattern { regsub -all -nocase "\\y$x\\y" $text "&" text } # and deliever the result return $text }