Regular expressions

Regular expressions are a way of searching for patterns in text. The basics are straight forward:

   letter    matches itself
   [string]  matches any character in string
   [^string] matches any character not in string
   .         matches anything
   *         matches the previous item zero or more times
   +         matches the previous item one or more times
   ?         matches the previous item zero or one time
   (expr)    groups a sequence into a single item for matching

E.g.,

   hello     matches hello (and Othello's and Hello)
   h.*o      matches hello, halo, ho, etc.
   h[aeo]w   matches haw hew how
   (the)+    matches "the the the ..."   

Expressions are case insensitive, but you can force it to match case after reading the complete regular expression documentation carefully. See the tcl man page for re_syntax

   http://www.tcl.tk/man/tcl8.2.3/TclCmd/re_syntax.htm

Browse Index