From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: How do I get a ] into a reg exp? Date: Thu, 14 Sep 2006 00:07:22 +0200 Message-ID: <85bqpjfmjp.fsf@lola.goethe.zz> References: <45085FF6.5080403@student.lu.se> <85wt87frgi.fsf@lola.goethe.zz> <450878C1.7020201@student.lu.se> <45087B49.7070807@student.lu.se> <45087C92.30407@student.lu.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1158185268 27302 80.91.229.2 (13 Sep 2006 22:07:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 13 Sep 2006 22:07:48 +0000 (UTC) Cc: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 14 00:07:46 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 1GNctP-0003BR-5q for ged-emacs-devel@m.gmane.org; Thu, 14 Sep 2006 00:07:39 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GNctO-0000n7-CG for ged-emacs-devel@m.gmane.org; Wed, 13 Sep 2006 18:07:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GNctB-0000mp-Jd for emacs-devel@gnu.org; Wed, 13 Sep 2006 18:07:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GNctA-0000mF-5m for emacs-devel@gnu.org; Wed, 13 Sep 2006 18:07:24 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GNct9-0000mC-Vp for emacs-devel@gnu.org; Wed, 13 Sep 2006 18:07:24 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GNcuy-0005qv-1q for emacs-devel@gnu.org; Wed, 13 Sep 2006 18:09:16 -0400 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1GNct9-0005wM-B4; Wed, 13 Sep 2006 18:07:23 -0400 Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id C270F1C40B5C; Thu, 14 Sep 2006 00:07:22 +0200 (CEST) Original-To: Lennart Borgman In-Reply-To: <45087C92.30407@student.lu.se> (Lennart Borgman's message of "Wed\, 13 Sep 2006 23\:48\:02 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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:59812 Archived-At: Lennart Borgman writes: > Lennart Borgman wrote: >>>> >>>> (info "(emacs) Regexps") >>>> >>>> To include a `]' in a character set, you must make it the first >>>> character. For example, `[]a]' matches `]' or `a'. To include a >>>> `-', write `-' as the first or last character of the set, or put >>>> it after a range. Thus, `[]-]' matches both `]' and `-'. >>>> >>>> To include `^' in a set, put it anywhere but at the beginning of >>>> the set. (At the beginning, it complements the set--see below.) >>>> >>>> >>> Thanks. That was a surprise. >> >> New surprise. I still can not get it to work. This is my actual search: >> >> (re-search-forward "'\\([][-+a-zA-Z~<>!;,:.'\"%/?(){}$^0|]\\)'" nil t) >> >> >> The above version does not match [ -- in the parenthesis. > But this one works: > > (re-search-forward "'\\([][+a-zA-Z~<>!;,:.'\"%/?(){}$^0|-]\\)'" nil t) > > The - must be last. Thanks again. Yes, [-+ is an empty range, since the first character is larger than the last. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum