all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Barry Margolin <barmar@alum.mit.edu>
To: help-gnu-emacs@gnu.org
Subject: Re: Another replace regexp with list question
Date: Mon, 10 Jun 2013 01:10:30 -0400	[thread overview]
Message-ID: <barmar-139663.01103010062013@news.eternal-september.org> (raw)
In-Reply-To: mailman.1310.1370826222.22516.help-gnu-emacs@gnu.org

In article <mailman.1310.1370826222.22516.help-gnu-emacs@gnu.org>,
 Leandro Marcolino <leandromarcolino@gmail.com> wrote:

> Hello, everyone!..
> 
> This time I am trying to find occurrences of:
> 
> "<span style='color:white'>&#31169;&#31169;&#31169;&#31169;</span>", but
> the number of &#31169; can change from 1 to many.
> 
> And I want to replace each &#31169; of the list to a white space (besides
> removing the <span> clause). So, if there were x "&#31169;", I need x " ".
> Is it possible to do this using replace-regexp?.. Of course I can't just
> look for "&#31169;" and replace to " ", because I have occurrences of
> "&#31169;" that are not inside the group "<span
> style='color:white'></span>".
> 
> I tried something like "<span style='color:white'>\(\(&#31169;\)+\)</span>
> -> \,(cond (\1 " ")))", but then I lose the information of how many
> "&#31169;" 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 &#31169 
with space, widen.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


       reply	other threads:[~2013-06-10  5:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1310.1370826222.22516.help-gnu-emacs@gnu.org>
2013-06-10  5:10 ` Barry Margolin [this message]
2013-06-10  7:50   ` Another replace regexp with list question Leandro Marcolino
2013-06-10 13:57     ` Drew Adams
2013-11-05  0:21   ` WJ
2013-06-11 18:23 ` Sean McAfee
2013-06-11 22:13   ` Leandro Marcolino
2013-06-10  1:03 Leandro Marcolino
2013-06-10 10:30 ` Peter Dyballa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=barmar-139663.01103010062013@news.eternal-september.org \
    --to=barmar@alum.mit.edu \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.