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: Wed, 13 Sep 2006 22:21:17 +0200 Message-ID: <85wt87frgi.fsf@lola.goethe.zz> References: <45085FF6.5080403@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 1158178926 5401 80.91.229.2 (13 Sep 2006 20:22:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 13 Sep 2006 20:22:06 +0000 (UTC) Cc: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 13 22:22:02 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 1GNbEj-0006yZ-BE for ged-emacs-devel@m.gmane.org; Wed, 13 Sep 2006 22:21:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GNbEi-0008Jr-Kp for ged-emacs-devel@m.gmane.org; Wed, 13 Sep 2006 16:21:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GNbEV-0008II-Rt for emacs-devel@gnu.org; Wed, 13 Sep 2006 16:21:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GNbEV-0008Hn-4A for emacs-devel@gnu.org; Wed, 13 Sep 2006 16:21:19 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GNbEU-0008Hi-U5 for emacs-devel@gnu.org; Wed, 13 Sep 2006 16:21:18 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GNbGI-0005VD-36 for emacs-devel@gnu.org; Wed, 13 Sep 2006 16:23:10 -0400 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1GNbEU-00022B-AV; Wed, 13 Sep 2006 16:21:18 -0400 Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id C66691C40B5C; Wed, 13 Sep 2006 22:21:17 +0200 (CEST) Original-To: Lennart Borgman In-Reply-To: <45085FF6.5080403@student.lu.se> (Lennart Borgman's message of "Wed\, 13 Sep 2006 21\:45\:58 +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:59804 Archived-At: Lennart Borgman writes: > How do I write > > (re-search-forward "[a-z\]]") > > I mean how do I get the ] into the characters to search for? It works > if I remove a-z. Looks like a bug to me. \] is the same as ] in string syntax. Anyway: (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.) -- David Kastrup, Kriemhildstr. 15, 44793 Bochum