From: Matthew Huggett <mhuggett@zam.att.ne.jp>
Cc: Help-gnu-emacs@gnu.org
Subject: Re: replacing strings
Date: Tue, 18 Jan 2005 16:30:37 +0900 (JST) [thread overview]
Message-ID: <20050118073037.A10AC197ED7@smtp2.att.ne.jp> (raw)
In-Reply-To: <20050118062244.17606.qmail@web54405.mail.yahoo.com> (message from SENTHIL S on Mon, 17 Jan 2005 22:22:44 -0800 (PST))
> 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
prev parent reply other threads:[~2005-01-18 7:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-18 6:22 replacing strings SENTHIL S
2005-01-18 7:30 ` Matthew Huggett [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050118073037.A10AC197ED7@smtp2.att.ne.jp \
--to=mhuggett@zam.att.ne.jp \
--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.
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).