Updated 2014-06-11 22:06:55 by AMG

Universally known as asterisk; commonly referred to by mathematicians and computer scientists as star. Among hackers, it is sometimes known as splat.

AMG: Not called astronaut or squishy bug nearly often enough [1].

As a mathematical operator

Used in the expr command as the multiplication operator, and evaluates to the product of its operands (which have to be numbers, either integers or floating point).
expr { \$a * \$b }

The mathop command version can multiply any number of (numerical) arguments together. In the edge cases, given one argument, it returns that; given zero arguments, it returns the multiplicative identity (1).
```set foo {3 4 8 22}
::tcl::mathop::* {*}\$foo
# => 2112
::tcl::mathop::* 42
# => 42
::tcl::mathop::*
# => 1```

As with all mathop commands, * can be made a lot more accessible by using namespace path, which means you don't need to write all those namespace qualifiers.
```namespace path {::tcl::mathop ::tcl::mathfunc}
* {*}\$foo
# => 2112
# if you do it like this, you are a silly person
set * \$foo
* {*}\${*}
# => 2112```

In regular expression syntax

* is used as a quantifier in regular expression syntax (historically, it's known as the "Kleene star" after Stephen Cole Kleene, who laid the foundation for, among other things, regular expressions). In this context, it means "match zero or more occurrences of the previous atom".
```# the string 'foo' *does* have zero or more 'a's in it
regexp {a*} foo
# => 1
# so does the empty string; in fact, *all* strings contain zero or more 'a's
regexp {a*} {}
# => 1
# do all the following strings match {ca*r}? yes, they do
::tcl::mathop::* {*}[lmap a {cr car caar caaar caaaar} { regexp {ca*r} \$a }]
# => 1
# looking at what's matched shows the difference between strings containing 'a's and those not containing 'a's
regexp -all -inline {a*} foo
# => {} {} {}
regexp -all -inline {a*} tanstaafl
# => {} a {} {} {} aa {} {}```

In string match syntax

In the string match command, * means "match any sequence of characters in a string, including a null string" (it is a simplified form of the regular expression quantified atom .*, which signifies the same match). The same holds for other commands that use patterns based on string match, such as info vars.
```string match *.bar foo.bar
# => 1
string match *.bar* .barbarian
# => 1
info vars ar*
# => argv argv0 argc```

In glob syntax

In a glob pattern, * means "[match] any sequence of zero or more characters" (which is basically the same thing as with string match).
```glob -nocomplain *.bar
# => (a list, possibly empty, containing any file names with the ".bar" extension you have in your current working directory.)```