[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is "]" == "\]"?



> "]" == "\]"
> 
> All tests said, that these two strings are equal. But how could I
> parse strings where "]" is command character or so but "\]" is legal
> syntax for using "]" as a normal character?
Since \ is an escape character in LISP you have to double it to 
get a string that actually contains the backslash. (see Steele CLtL2, p34)
(Undefined escape sequences may just ignore the backslash, thus "\["
is identical to "[").
So just double your backslash: "\\["

Johann Petrak                            Email: johann@ai.univie.ac.at
Austrian Research Institute for          Phone:        +43-1-533-61-12
Artificial Intelligence                                +43-1-535-32-81/0
Schottengasse 3                          Fax:          +43-1-532-06-52
A-1010 Vienna, AUSTRIA                   Private Phone:+43-1-24-03-173
					 http://www.ai.univie.ac.at