lsearch(n) Tcl Built-In Commands lsearch(n) _________________________________________________________________ NAME lsearch - See if a list contains a particular element SYNOPSIS lsearch ?_m_o_d_e? _l_i_s_t _p_a_t_t_e_r_n _________________________________________________________________ DESCRIPTION This command searches the elements of _l_i_s_t to see if one of them matches _p_a_t_t_e_r_n. If so, the command returns the index of the first matching element. If not, the command returns - 1. The _m_o_d_e argument indicates how the elements of the list are to be matched against _p_a_t_t_e_r_n and it must have one of the following values: -exact The list element must contain exactly the same string as _p_a_t_t_e_r_n. -glob _P_a_t_t_e_r_n is a glob-style pattern which is matched against each list element using the same rules as the string match command. -regexp _P_a_t_t_e_r_n is treated as a regular expression and matched against each list element using the same rules as the regexp command. If _m_o_d_e is omitted then it defaults to -glob. KEYWORDS list, match, pattern, regular expression, search, string Tcl Last change: 7.0 1