Frank
2015-06-12 21:45:02 UTC
Hi,
I just hit this corner case. Is there a way to do this or a better way to search for these type of strings in a list?
As you can see from the example below lsearch fails to find the match when square brackets are used in the list elements.
% set a {A[0]}
A[0]
% lsearch $a $a
-1
% set a {A\[0\]}
A\[0\]
% lsearch $a $a
0
Thanks in advance,
Frank
I just hit this corner case. Is there a way to do this or a better way to search for these type of strings in a list?
As you can see from the example below lsearch fails to find the match when square brackets are used in the list elements.
% set a {A[0]}
A[0]
% lsearch $a $a
-1
% set a {A\[0\]}
A\[0\]
% lsearch $a $a
0
Thanks in advance,
Frank