From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: Unquoted special characters in regexps Date: Sat, 25 Feb 2006 16:13:11 -0600 (CST) Message-ID: <200602252213.k1PMDBP24413@raven.dms.auburn.edu> References: <4400AD8E.5050001@gmx.at> <4400BBB1.2050800@gmx.at> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1141403190 2224 80.91.229.2 (3 Mar 2006 16:26:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 3 Mar 2006 16:26:30 +0000 (UTC) Cc: schwab@suse.de, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 03 17:26:29 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FFD6B-0003Rm-7O for ged-emacs-devel@m.gmane.org; Fri, 03 Mar 2006 17:25:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FFD69-0002ZE-Ih for ged-emacs-devel@m.gmane.org; Fri, 03 Mar 2006 11:25:45 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FEh8E-0007JT-D5 for emacs-devel@gnu.org; Thu, 02 Mar 2006 01:17:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FD7jg-00053Y-2s for emacs-devel@gnu.org; Sat, 25 Feb 2006 17:18:01 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FD7jc-000527-Vl for emacs-devel@gnu.org; Sat, 25 Feb 2006 17:17:53 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FD7k0-00035j-9V for emacs-devel@gnu.org; Sat, 25 Feb 2006 17:18:16 -0500 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.13.3+Sun/8.13.3) with ESMTP id k1PMHieB008022; Sat, 25 Feb 2006 16:17:44 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id k1PMDBP24413; Sat, 25 Feb 2006 16:13:11 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: rudalics@gmx.at In-reply-to: <4400BBB1.2050800@gmx.at> (message from martin rudalics on Sat, 25 Feb 2006 21:18:57 +0100) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.1 (manatee.dms.auburn.edu [131.204.53.104]); Sat, 25 Feb 2006 16:17:44 -0600 (CST) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:51068 Archived-At: Martin Rudalics wrote: `]' is _also_ special in a character alternative, like `^'. `-' is special _only_ in a character alternative. I may be overlooking something, but _which_ special meaning does `]' have outside of character alternatives? You are using \\] to quote `]'. Could that possibly clear up any confusion or does it just add confusion? I personally believe the latter. Is there a situation where \\ can be used to prevent `]' from having a special meaning? In "[a\\]b]", the first `]' still has a special meaning, even though there might be some optical illusion making it look "quoted", the second `]' has no special meaning. The only way I know of to put a "quoted" `]' in a character alternative is to write it immediately after the `[' or "[^". But "quoting" `]' by writing "[]]" instead of just `]', seems contorted, even though it would be less confusing than "\\]". I believe that a `]' should not be quoted at all if it is outside a character alternative, where it has no special meaning, unless I am overlooking something. (Just tell what, in that case.) ELISP> (string-match "[a\\]b]" "]") nil ELISP> (string-match "[a\\]b]" "\\b") nil ELISP> (string-match "[a\\]b]" "\\b]") 0