From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: harven Newsgroups: gmane.emacs.help Subject: Re: Help with regexp Date: Wed, 02 Dec 2009 21:00:04 +0100 Organization: http://groups.google.com Message-ID: References: <87y6lmtnbx.fsf@galatea.local> <20091202051626.GA19970@tomas> <87vdgpbtlp.fsf@ergodik.univ-brest.fr> <87ocmhtsd2.fsf@fh-trier.de> <87d42xs4bi.fsf@fh-trier.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1259794925 578 80.91.229.12 (2 Dec 2009 23:02:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Dec 2009 23:02:05 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 03 00:01:57 2009 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.50) id 1NFyCp-0005Cj-A6 for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Dec 2009 00:01:55 +0100 Original-Received: from localhost ([127.0.0.1]:60066 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFyCo-0006la-PQ for geh-help-gnu-emacs@m.gmane.org; Wed, 02 Dec 2009 18:01:54 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!feeder1-2.proxad.net!cleanfeed3-b.proxad.net!nnrp2-2.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (darwin) Cancel-Lock: sha1:KUcziE5PZRWpd1A/HfQQnhfaEHM= Original-Lines: 29 Original-NNTP-Posting-Date: 02 Dec 2009 21:00:03 MET Original-NNTP-Posting-Host: 78.233.232.132 Original-X-Trace: 1259784003 news-1.free.fr 30477 78.233.232.132:50101 Original-X-Complaints-To: abuse@proxad.net Original-Xref: news.stanford.edu gnu.emacs.help:175261 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:70338 Archived-At: Lennart Borgman writes: > On Wed, Dec 2, 2009 at 5:56 PM, Andreas Politz wrote: >> >> This reminds me of something else regexp related,  though fixable. >> Navigating point inside a regexp is very painfully. > > How does it hurt? That way (quoting the emacs wiki, ParenthesisMatching). "...It should be noted that the syntax-table makes all delimiters even. That means that a beginning parenthesis ( may match a closing bracket ] if the delimiters are not balanced as a whole. Try C-M-f on the following expression: ( [ ) ] Here is a short piece of Lisp code in which such a situation occurs: (while (re-search-forward "\\(\\[[0-9]\\),\\([0-9]\\]\\)" nil t) (replace-match (concat (match-string 1) "." (match-string 2)))) This code replaces, e.g. [4,5] by [4.5]. Now, in the regular expression between quotes " ", the first opening bracket [ matches the first closing parenthesis ), whereas the last opening parenthesis ( matches the last closing bracket ]..."