From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leandro Marcolino Newsgroups: gmane.emacs.help Subject: Re: Another replace regexp with list question Date: Mon, 10 Jun 2013 00:50:33 -0700 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1370850655 22659 80.91.229.3 (10 Jun 2013 07:50:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Jun 2013 07:50:55 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 10 09:50:56 2013 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 1UlwsR-0008FR-7V for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Jun 2013 09:50:55 +0200 Original-Received: from localhost ([::1]:48799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UlwsQ-0003pv-Tu for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Jun 2013 03:50:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UlwsA-0003pg-Oe for help-gnu-emacs@gnu.org; Mon, 10 Jun 2013 03:50:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ulws6-0003ft-SN for help-gnu-emacs@gnu.org; Mon, 10 Jun 2013 03:50:38 -0400 Original-Received: from mail-ea0-x22c.google.com ([2a00:1450:4013:c01::22c]:43387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ulws6-0003fe-IK for help-gnu-emacs@gnu.org; Mon, 10 Jun 2013 03:50:34 -0400 Original-Received: by mail-ea0-f172.google.com with SMTP id q10so3769569eaj.3 for ; Mon, 10 Jun 2013 00:50:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=QYRBi3hZLmcXhnRjL9/FQB1tHBGvUB3vKYii2zD75k4=; b=VIJChi/KEvTGweHNt5hCTN8+AAHAYF7dLwM/Mjy5xXsk98QUC7qZL390Hnky6rnEOv 7ziVjoX9+QpK/9JwSccxH6HYyj6ZfkIPU4K6K+0HNBWne3Qx49kRAObii+Z1EqF2tdxP eGYIi3YsFkw+/lA63fQl3782RETlHO/m4Cf7kaVdM1FNNQJ92MHJeITKdyNPJe6eaiOt OTBllTShoadbgTuwSmwLY29Zl44KAogim1n3z+Ns+OSUPa+yKJcxQMTK6ZEtkMmyGeFo tR/gicACLPB6Rjo8HX/9MnwPesHJ8Fgdc50PRS5avMSSNQ21KgGB0WbWgEynEVF5M0RM Gf5Q== X-Received: by 10.14.95.135 with SMTP id p7mr8275397eef.16.1370850633677; Mon, 10 Jun 2013 00:50:33 -0700 (PDT) Original-Received: by 10.14.175.2 with HTTP; Mon, 10 Jun 2013 00:50:33 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::22c X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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:91428 Archived-At: Oh, I see.... I didn't know about the "narrow" and "widen" commands before. They are very useful! :) Thank you very much!.. Leandro On Sun, Jun 9, 2013 at 10:10 PM, Barry Margolin wrote: > In article , > Leandro Marcolino wrote: > > > Hello, everyone!.. > > > > This time I am trying to find occurrences of: > > > > "私私私私", but > > the number of 私 can change from 1 to many. > > > > And I want to replace each 私 of the list to a white space (besides > > removing the clause). So, if there were x "私", I need x " > ". > > Is it possible to do this using replace-regexp?.. Of course I can't just > > look for "私" and replace to " ", because I have occurrences of > > "私" that are not inside the group " > style='color:white'>". > > > > I tried something like " style='color:white'>\(\(私\)+\) > > -> \,(cond (\1 " ")))", but then I lose the information of how many > > "私" were there, and everything changes to a single " ".... > > > > Thanks for your help!.. :) > > > > Regards, > > Leandro > > Regular expressions can't count. > > I would do it with a keyboard macro. Search for the span, mark it as a > region, narrow to region, use replace-string to replace each 私 > with space, widen. > > -- > Barry Margolin, barmar@alum.mit.edu > Arlington, MA > *** PLEASE post questions in newsgroups, not directly to me *** >