From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: bug in elisp... or in elisper??? Date: Thu, 24 Mar 2011 21:44:36 -0600 Message-ID: References: <4D8932A8.9080007@mousecar.com> <4D8A013A.1030804@mousecar.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1301026011 12312 80.91.229.12 (25 Mar 2011 04:06:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 25 Mar 2011 04:06:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 25 05:06:45 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q2yHM-0003qa-27 for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Mar 2011 05:06:45 +0100 Original-Received: from localhost ([127.0.0.1]:53086 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q2yHH-0003kj-GK for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Mar 2011 00:05:35 -0400 Original-Received: from [140.186.70.92] (port=38094 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q2xx2-0003mD-Pj for help-gnu-emacs@gnu.org; Thu, 24 Mar 2011 23:44:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q2xx0-00035E-TG for help-gnu-emacs@gnu.org; Thu, 24 Mar 2011 23:44:40 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:47151) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q2xx0-00034H-Jg for help-gnu-emacs@gnu.org; Thu, 24 Mar 2011 23:44:38 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q2xwy-0005rR-S8 for help-gnu-emacs@gnu.org; Fri, 25 Mar 2011 04:44:36 +0100 Original-Received: from c-24-8-96-241.hsd1.co.comcast.net ([24.8.96.241]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 25 Mar 2011 04:44:36 +0100 Original-Received: from kevin.d.rodgers by c-24-8-96-241.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 25 Mar 2011 04:44:36 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 50 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-24-8-96-241.hsd1.co.comcast.net User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 In-Reply-To: <4D8A013A.1030804@mousecar.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:80415 Archived-At: On 3/23/11 8:18 AM, ken wrote: ... > You might have noticed I use "\\([\s-\\|\n]+?\\)" to non-greedily match > one or more whitespace characters. Can one "\\[...\\] be nested inside > another...? e.g., "[[\s-\\|\n]+?]" or some syntax like that? No. It is not clear whether you mean "\s" (space) followed by "-" (which is special within "[]"), or you actually meant "\\s-" (i.e. any character with whitespace syntax). The problem with "\\s-" is that it depends on the buffer's syntax table, as does "[[:space:]]" -- see section 34.3.1.2 (Character Classes) in the Emacs Lisp manual for an explanation of "[[:space:]]" and other POSIX-inspired character classes: http://en.wikipedia.org/wiki/Regular_expression#POSIX_character_classes If you are going to add "\n" to "\\s-" or "[:space:]", within "[]" or "\\(\\|\\)", because you can't be sure whether the buffer's syntax table assigns whitespace syntax to newline, then how can you be sure that it assigns whitespace syntax to space, tab, formfeed, return, and vertical tab? So you may as well be explicit about what you mean by whitespace e.g. "[ \f\t\n\r\v]" > The "specialness" of "." seems to be lost when inside brackets; that is, > in "[.\n]*?" it seems to represent a regular period (.) rather than "any > character except newline". Is there some way to bring back that > specialness? Or is there some other RE to represent "multiple instances > of any character, including a newline"? No, inside "[]", "." is not special. The right way is: "\\(.\\|\n\\)*" There may be other ways, but they will be longer and unnecessarily complex. > Is it actually true (what the docs say) that there's a limit of nine > sub-expression match-strings per RE? Or can I do, e.g., "(match-string > 12)" and "(match-string 15)"? What is the actual limit? Whatever it > is, is this hard-coded into elisp... or can it be changed/configured to > something else? No, but you can only refer to the first 9 sub-expressions (actually, the text matched by each of the first 9 preceding sub-expressions). -- Kevin Rodgers Denver, Colorado, USA