From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.help Subject: Re: Regarding replacing regexp Date: Thu, 10 May 2012 18:26:33 +0200 Message-ID: <4FABEC39.6060305@dogan.se> References: NNTP-Posting-Host: plane.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 1336667227 14170 80.91.229.3 (10 May 2012 16:27:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 10 May 2012 16:27:07 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: shirish Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 10 18:27:05 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SSWCn-0006Cg-D2 for geh-help-gnu-emacs@m.gmane.org; Thu, 10 May 2012 18:27:05 +0200 Original-Received: from localhost ([::1]:34344 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSWCm-0005RI-IK for geh-help-gnu-emacs@m.gmane.org; Thu, 10 May 2012 12:27:04 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSWCd-0005Q4-7X for help-gnu-emacs@gnu.org; Thu, 10 May 2012 12:27:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SSWCb-0002LX-2c for help-gnu-emacs@gnu.org; Thu, 10 May 2012 12:26:54 -0400 Original-Received: from mxf1.bahnhof.se ([213.80.101.25]:49381) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSWCa-0002L5-Se for help-gnu-emacs@gnu.org; Thu, 10 May 2012 12:26:53 -0400 Original-Received: from localhost (mxf1.local [127.0.0.1]) by mxf1-reinject (Postfix) with ESMTP id 69F611E316F; Thu, 10 May 2012 18:26:50 +0200 (CEST) X-Virus-Scanned: by amavisd-new using ClamAV at bahnhof.se (MXF1) Original-Received: from mxf1.bahnhof.se ([127.0.0.1]) by localhost (mxf1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zxq0MgG4Uzro; Thu, 10 May 2012 18:26:48 +0200 (CEST) Original-Received: from [176.10.168.241] (h-168-241.a336.priv.bahnhof.se [176.10.168.241]) by mxf1.bahnhof.se (Postfix) with ESMTP id 9D3E41E3145; Thu, 10 May 2012 18:26:47 +0200 (CEST) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 213.80.101.25 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84799 Archived-At: On 2012-05-10 11:37, shirish wrote: > Hi, > > I am in the process of learning how to use emacs. I know about the > replace-regexp but I am unable to create a regular expression to do the > below. > Any help is much appreciated. > > public static final String SUCCESS //Successmesg > public static final String FAILURE //failuremessage > > I need to replace that with > > public static final String SUCCESS = "SUCCESS";//Successmesg > public static final String FAILURE = "FAILURE"; //failuremessage > > Thanks, > Shirish. > > There are a lot of ways to do it. One could be: String \([^ ]+\) and replace it with: String \1 = "\1" I would personally use keyboard macros for it. I hope that helps, Deniz