I am swamped by matching two strings which contain "[" characters.
expect(0,string) stores a string containing "[". Then, I want to verify
it with a pattern, since tcl's "[" has special meaning, it can not work
as I wanted!
I tried to drop these "["s in expect(0,string), but I have not found a
method to do so.
What could I do?
--
Alan
Well the "[" character has a special meaning for regular expressions
too,
but in both cases a well-placed "\" will remove the magic.
Try:
set string "\[ABC\]"
regexp {\[A} $string
(I almost always use braces when specifying regular expressions as this
limits the conflicts between regexp and Tcl to the minimum)
Regards,
Arjen