From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Pascal Bourguignon Newsgroups: gmane.emacs.help Subject: Re: Emacs regexp problem Date: Tue, 29 Jan 2008 19:50:09 +0100 Organization: Informatimago Message-ID: <87k5lsqxem.fsf@thalassa.informatimago.com> References: <79627687-f8b7-42f7-a6c4-230d6f525a53@e6g2000prf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1201635640 4843 80.91.229.12 (29 Jan 2008 19:40:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Jan 2008 19:40:40 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 29 20:41:00 2008 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 1JJwKJ-0001Kh-VU for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Jan 2008 20:41:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJwJs-00064H-O4 for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Jan 2008 14:40:32 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.r-kom.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 32 Original-X-Trace: individual.net Te40m4rtlrvx9vuIgvyYwgY6pyuqAVHLqUKvk/C6kWvbQK4Xxv Cancel-Lock: sha1:NGMyOTY2ODdjNmIzNDhjMzcyNWYwMmRjYjRkMWVjNTYzM2Y0ODFmNA== sha1:YLjgDx7wK2qBoExsDcPYzmyKOZo= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.1.50 (gnu/linux) Original-Xref: shelby.stanford.edu gnu.emacs.help:155682 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:51062 Archived-At: "mailpitches@email.com" writes: > Hello, I'm doing an emacs replace-regexp and the regexp behaves > differently from how it behaves in Python, and also differently from > how I expect. > > I'm trying to add quotes around the parameter in a function call. > I.e.: > func(param) should be converted to func('param') > > I use the following command: > M-x replace-regexp [enter] get\((.*)\) [enter] get('\1')) [enter] > > and the result is func(param) is converted to func('(param)') > > Why are those extra parentheses appearing in there; is this an error > on emacs' part? Read the doc! (info "(emacs)Regexps") emacs regexp are more like BRE than ERE in this respect. Use: M-x replace-regexp RET get(\(.*\)) RET get('\1')) RET -- __Pascal Bourguignon__ http://www.informatimago.com/ READ THIS BEFORE OPENING PACKAGE: According to certain suggested versions of the Grand Unified Theory, the primary particles constituting this product may decay to nothingness within the next four hundred million years.