I find the concept of a quasichar to be useful in explaining regular-expression pattern matching. Here are descriptions of the special symbols that are directly related to quasichars. Preference is to the longest match. Preference is to the longest match.
Preference is to the longest match.
I call these special symbols repeaters for obvious reasons. Repeaters introduce the possibility that more than one matching substring might begin at the same position in the string. Regular expressions are more than just a sequence of quasichars with possible repeaters, they can be several sequences of quasichars with possible repeaters. Each branch defines a different possible match. Now for a major difference between Tcl's version 8.1 and everything that came before.