From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: How do I get a ] into a reg exp? Date: Wed, 13 Sep 2006 23:42:33 +0200 Message-ID: <45087B49.7070807@student.lu.se> References: <45085FF6.5080403@student.lu.se> <85wt87frgi.fsf@lola.goethe.zz> <450878C1.7020201@student.lu.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1158183786 22589 80.91.229.2 (13 Sep 2006 21:43:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 13 Sep 2006 21:43:06 +0000 (UTC) Cc: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 13 23:43:03 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 1GNcVM-0006Y8-Jg for ged-emacs-devel@m.gmane.org; Wed, 13 Sep 2006 23:42:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GNcVM-0004st-1j for ged-emacs-devel@m.gmane.org; Wed, 13 Sep 2006 17:42:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GNcVA-0004se-HB for emacs-devel@gnu.org; Wed, 13 Sep 2006 17:42:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GNcVA-0004sP-2E for emacs-devel@gnu.org; Wed, 13 Sep 2006 17:42:36 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GNcV9-0004sM-SZ for emacs-devel@gnu.org; Wed, 13 Sep 2006 17:42:35 -0400 Original-Received: from [81.228.11.159] (helo=pne-smtpout2-sn1.fre.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GNcWw-0003hn-Rm; Wed, 13 Sep 2006 17:44:27 -0400 Original-Received: from [192.168.123.121] (83.249.218.244) by pne-smtpout2-sn1.fre.skanova.net (7.2.075) id 44FEC7CA00203684; Wed, 13 Sep 2006 23:42:34 +0200 User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) Original-To: Lennart Borgman In-Reply-To: <450878C1.7020201@student.lu.se> 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:59809 Archived-At: Lennart Borgman wrote: > David Kastrup wrote: >> 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.) >> >> > 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.