`$tcl_wordchars` and `$tcl_nonwordchars` are [tclvars%|%built-in] global variables which each contain a [regular expression] that is used by routines like [tcl_endofword] to identify whether a character is part of a word. ** See Also ** [tclvars]: for other variables used by [tcl]/[tk]. ** Description ** If the pattern in `$tcl_wordchars` matches a character, the character is considered to be a word character. On [Microsoft Windows%|%Windows] platforms, words are comprised of any character that is not a space, tab, or newline. Under Unix, words are comprised of numbers, letters or underscores. They are auto-loaded along with the commands they control, such as `[tcl_endOfWord]`. This means that to change the characters that are valid, you must first do something like: ====== catch {tcl_endOfWord} ====== After this, you can then do something like: ====== # We want the same behaviour on Windows as on Unix for double-clicking set tcl_wordchars {[a-zA-Z0-9_]} set tcl_nonwordchars {[^a-zA-Z0-9_]} ====== [MG]: The defaults for Unix (or rather, non-Windows), according to the docs for Tcl 8.4.9, are actually '''\w''' and '''\W''' (with '''\s''' and '''\S''' on Windows), which might differ from the above due to locale. Personally, I tend to use ====== set tcl_wordchars {[a-zA-Z0-9' ]} set tcl_nonwordchars {[^a-zA-Z0-9']} ====== for my apps on Windows - I tend to find that gives much more natural behaviour, particularly compared to other apps when you move the cursor a word at a time with Control-Left / Control-Right. ---- [[To Do: Add list of [tcl] and [tk] routines that actually use these variables.]] <> Internals