unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* replacing strings
@ 2005-01-18  6:22 SENTHIL S
  2005-01-18  7:30 ` Matthew Huggett
  0 siblings, 1 reply; 2+ messages in thread
From: SENTHIL S @ 2005-01-18  6:22 UTC (permalink / raw)


hi,
How to replace a string with the same string+something
..

eg: sum - [sum]
    moon - [moon]
thanks

=====
====================================
1.I ADMIRE THE INNOCENCE OF CHLDHOOD. 
2.ALL ARE SAME BEFORE DEATH.
3.SOMETIMES YOU NEVER KNOW WHAT YOU CAN DO UNLESS
YOU START DOING IT.


		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: replacing strings
  2005-01-18  6:22 replacing strings SENTHIL S
@ 2005-01-18  7:30 ` Matthew Huggett
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Huggett @ 2005-01-18  7:30 UTC (permalink / raw)
  Cc: Help-gnu-emacs


>    Date: Mon, 17 Jan 2005 22:22:44 -0800 (PST)
>    From: SENTHIL S <senfunn@yahoo.com>
>    Content-Type: text/plain; charset=us-ascii
>    Cc: 
>    Sender: help-gnu-emacs-bounces+mhuggett=zam.att.ne.jp@gnu.org
> 
>    hi,
>    How to replace a string with the same string+something
>    ..
> 
>    eg: sum - [sum]
>        moon - [moon]
>    thanks

Use parentheses in a regular expression to capture part of the match.
For example, for the simple cases you have give, you might try:

    M-x replace-regexp

and give \(\w+\b\) for the regexp and [\1] for the replacement.  The
\1 will give you whatever was captured by the () in the regexp.


Matthew

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-01-18  7:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-18  6:22 replacing strings SENTHIL S
2005-01-18  7:30 ` Matthew Huggett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).