> On Thu, 2006-03-16 at 18:41, Vin Shelton wrote:
> > Hi Chris,
> > It wasn't completely clear to me what you had done. Do you know that
> > the part to be repeated must be enclosed in between \( and \) ?
> >
> > E.g.
> >
> > C-x b *scratch*
> > M-x replace-regexp
> > \(for\)
> > xxx\1yyy
> >
> > This will replace all occurances of "for" with xxxforyyy.
> >
> > Hope this helps. Please follow up if it doesn't.
On 3/16/06, Chris Rowse <chris(a)forth.co.za> wrote:
> Hi Vin,
> Thank you very much for the feedback.
>
> The fine manual does not indicate the \( \) round the numbered
> replacement - either in emacs or xemacs. I had tried unescaped () and
> [], neither of which worked (obviously, once I understand the escape)
>
> Your solution works like a charm
Hi Chris,
I think TFM is actually fairly clear. C-h f replace-regexp says:
...
Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace
only matches surrounded by word boundaries.
In TO-STRING, `\&' stands for whatever matched the whole of REGEXP,
and `\N' (where N is a digit) stands for
whatever what matched the Nth `\(...\)' in REGEXP.
Now granted you have to read through a couple of paragraphs to get
there, but I find the explanation clear enough. If you can think of
how to improve it, a patch would be considered.
Regards,
Vin
--
Whoever you are, no matter how lonely,
the world offers itself to your imagination,
calls to you like the wild geese, harsh and exciting--
over and over announcing your place
in the family of things. Mary Oliver