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:48:02 +0200 Message-ID: <45087C92.30407@student.lu.se> References: <45085FF6.5080403@student.lu.se> <85wt87frgi.fsf@lola.goethe.zz> <450878C1.7020201@student.lu.se> <45087B49.7070807@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 1158184116 23639 80.91.229.2 (13 Sep 2006 21:48:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 13 Sep 2006 21:48:36 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 13 23:48:32 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 1GNcan-0007gq-SU for ged-emacs-devel@m.gmane.org; Wed, 13 Sep 2006 23:48:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GNcan-0001KI-CH for ged-emacs-devel@m.gmane.org; Wed, 13 Sep 2006 17:48:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GNcac-0001Hq-2f for emacs-devel@gnu.org; Wed, 13 Sep 2006 17:48:14 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GNcaX-0001H5-Hn for emacs-devel@gnu.org; Wed, 13 Sep 2006 17:48:12 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GNcaX-0001Gs-CP for emacs-devel@gnu.org; Wed, 13 Sep 2006 17:48:09 -0400 Original-Received: from [81.228.8.83] (helo=pne-smtpout1-sn2.hy.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GNccL-00042g-43 for emacs-devel@gnu.org; Wed, 13 Sep 2006 17:50:01 -0400 Original-Received: from [192.168.123.121] (83.249.218.244) by pne-smtpout1-sn2.hy.skanova.net (7.2.075) id 450708BC000513DB for emacs-devel@gnu.org; Wed, 13 Sep 2006 23:48:08 +0200 User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) Original-To: Emacs Devel In-Reply-To: <45087B49.7070807@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:59810 Archived-At: Lennart Borgman wrote: > 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. But this one works: (re-search-forward "'\\([][+a-zA-Z~<>!;,:.'\"%/?(){}$^0|-]\\)'" nil t) The - must be last. Thanks again.