DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

lsearch(TCL)


lsearch -- see if a list contains a particular element

Synopsis

lsearch [mode] list pattern

Description

This command searches the elements of list to see if one of them matches pattern. If so, the command returns the index of the first matching element. If not, the command returns -1. The mode argument indicates how the elements of the list are to be matched against pattern; it must have one of the following values:

-exact
The list element must contain exactly the same string as pattern.

-glob
pattern is a glob-style pattern which is matched against each list element using the same rules as the string match command.

-regexp
pattern is treated as a regular expression and matched against each list element using the same rules as the regexp command.
If mode is omitted then it defaults to -glob.

References


02 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 02 June 2005