[Top][All Lists]

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

Re: Unquoted special characters in regexps

From: Andreas Schwab
Subject: Re: Unquoted special characters in regexps
Date: Sun, 26 Feb 2006 14:50:38 +0100
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux)

martin rudalics <address@hidden> writes:

> That of closing a character alternative.  When you write
> (defvar foo "]")
> (defvar bar "\\]")
> you can't interchangeably use `foo' and `bar' in an arbitrary regular
> expression.  Some people call this "referential transparency".

Of course you can't, since the meaning of '\' is context dependent.

> Anyway, the first `]' has a special meaning but it's not "inside" the
> character alternative.

It is part of it, just like the leading '['.

> It does have a special meaning because `]' is special _outside_
> character alternatives.

This is wrong.  Outside of a character set ']' has no special meaning
whatsoever, independent of the context.

> According to the Elisp manual all these exhibit "poor practice" since
> you didn't quote the second `]'s.

It's a bug in the manual.


Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]