Syntax Summary

Table 11-1 summarizes the syntax of regular expressions available in all versions of Tcl:

Table 11-1. Basic regular expression syntax.
.Matches any character.
*Matches zero or more instances of the previous pattern item.
+Matches one or more instances of the previous pattern item.
?Matches zero or one instances of the previous pattern item.
( )Groups a subpattern. The repetition and alternation operators apply to the preceding subpattern.
|Alternation.
[ ]Delimit a set of characters. Ranges are specified as [x-y]. If the first character in the set is ^, then there is a match if the remaining characters in the set are not present.
^Anchor the pattern to the beginning of the string. Only when first.
$Anchor the pattern to the end of the string. ...

Get Practical Programming in Tcl & Tk, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.