lsearch

See if a list contains a particular element 

Tclsh Built-In Commands


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 and 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 rules described in the re_syntax reference page.

If mode is omitted then it defaults to -glob.


PORTABILITY

Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


PTC MKS Toolkit 10.4 Documentation Build 39.