By default, lsearch uses the "globbing" method of finding a match. Globbing is the wildcarding technique that most Unix shells use.
globbing wildcards are:
- *
- Matches any quantity of any character
- ?
- Matches one occurrence of any character
- \X
- The backslash escapes a special character in globbing just the way it does in Tcl substitutions. Using the backslash lets you use glob to match a * or ?.
- [...]
- Matches one occurrence of any character within the brackets. A range of characters can be matched by using a range between the brackets. For example, [a-z] will match any lower case letter.
There is also a
glob
command that you will see in later sections that uses glob pattern matching in directories, and returns a list of the matching files.Example
# Matchesstring match f* foo# Matchesh f?? foo # Doesn'tstring mat c match string match f foos on my Debian system. set bins [glob /usr/bin/*]# Returns a big list of file
No comments:
Post a Comment