help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replace regexp question


From: Leandro Marcolino
Subject: Re: Replace regexp question
Date: Sat, 8 Jun 2013 09:44:28 -0700

Thank you very much for all the replies!.. :) But, maybe my example was too
simplistic.... hehe

I want to file occurrences of "<span lang=ZH-CN
>&#31169;&#31169;&#31169;</span><span lang=PT-BR", but the number of
&#31169; can be one or more, and replae by "<span lang=ZH-CN
style='letter-spacing:-5px'>&#31169;&#31169;&#31169;</span><span
lang=PT-BR".

If I try: "<span lang=ZH-CN >\(&#31169;+\)</span><span lang=PT-BR -> <span
lang=ZH-CN style='letter-spacing:-5px'>\1</span><span lang=PT-BR" then no
pattern is found
If I try: "<span lang=ZH-CN >\(&#31169;\)+</span><span lang=PT-BR -> <span
lang=ZH-CN style='letter-spacing:-5px'>\1</span><span lang=PT-BR" then the
sequence of &#31169; changes to a single &#31169;.

Is there a way to solve this problem?...

Thank you very much!..

Thanks,
Leandro


On Sat, Jun 8, 2013 at 8:11 AM, Pascal J. Bourguignon [via Emacs] <
ml-node+s1067599n288199h15@n5.nabble.com> wrote:

> Leandro Marcolino <[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=288199&i=0>>
> writes:
>
> > Hello, all!..
> >
> > I am trying to add text after multiple occurrences of a group, but it is
> not
> > working. For example, if I try to change the following: "aaaaaa" to
> > "aaaaaab", I end up with "ab"...
> >
> > I am looking for the regexp: \(a\)+ and I replace by \1b. But then the
> > sequence of a's is reduced to a single "a". How can I make the final
> text
> > have the same number of occurrences of the group as the original text?..
>
> That's because there is a single a inside \( \)!
> Try: \(a+\) -> \1b
>
> --
> __Pascal Bourguignon__                     http://www.informatimago.com/
> A bad day in () is better than a good day in {}.
> You can take the lisper out of the lisp job, but you can't take the lisp
> out
> of the lisper (; -- antifuchs
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://emacs.1067599.n5.nabble.com/Replace-regexp-question-tp288179p288199.html
>  To unsubscribe from Replace regexp question, click 
> here<http://emacs.1067599.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=288179&code=bGVhbmRyb21hcmNvbGlub0BnbWFpbC5jb218Mjg4MTc5fC0xNDQxMDQ2NDk4>
> .
> NAML<http://emacs.1067599.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]