Navigation Logo Regexp and Regsub Navigation Logo

 

 

Online chapter from Tcl/Tk for Programmers (with exercises and solutions).

Much programming in Tcl involves handling data from users, files, or other computer programs. Often this data does not arrive in a form that is directly usable. The need to extract useful pieces from the whole is a major reason for you to master regular expressions. You will probably use them a lot.

Using regular expressions and using them correctly are not the same thing. It is not uncommon for a badly written regular expression to pass tests only to fail in practice. One of the goals of this chapter is to show you how you can write them well.

7.1 Theory and Practice
7.2 Character Set, Quoting, and Style
7.3 Regular-Expression versus Glob Patterns
7.4 Repetitions and Branches
7.5 Use Parentheses to Build more Complicated Patterns
7.6 Use Parentheses to Extract Subpatterns
7.7 Search and Replace
7.8 Style Review
7.9 Solutions to Exercises
 

 

[Sample TK Application]
Author's Home Page
Navigation Logo [Book's Cover]
Order from Amazon.