From: Matthew Flaschen <matthew.flaschen@gatech.edu>
To: emacs <help-gnu-emacs@gnu.org>
Subject: Re: regexp help
Date: Fri, 02 Feb 2007 23:31:30 -0500 [thread overview]
Message-ID: <45C41022.1020302@gatech.edu> (raw)
In-Reply-To: <45C40F15.8060901@gatech.edu>
[-- Attachment #1.1: Type: text/plain, Size: 884 bytes --]
Matthew Flaschen wrote:
> gokhalen@gmail.com wrote:
>> Hi,
>>
>> I needed to replace lines matching the following pattern
>>
>> "hello 123456123456"
>>
>> with
>>
>> "hello 123456 123456"
>>
>> I used
>>
>> M-x replace-regexp RET hello ...... RET \& /
>> * NOTE: a white space follows the \& */
>>
>> To do this.
>>
>> I was wondering how I would do this with the \d construct. That is how
>> would I do this along the lines of
>
> I'm not sure, but I think you want this:
>
> M-x replace-regexp
> \([0-9][0-9][0-9][0-9][0-9][0-9]\)\([0-9][0-9][0-9][0-9][0-9][0-9]\) RET
> \1 \2 RET
>
> There may be some way to avoid repeating the [0-9] but I couldn't figure
> that out.
Never mind. I just forgot the escape. The best way (I think) is:
\([0-9]\{6\}\)\([0-9]\{6\}\) RET \1 \2 RET
Matthew Flaschen
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
next prev parent reply other threads:[~2007-02-03 4:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-02 23:20 regexp help gokhalen
2007-02-03 3:37 ` HS
2007-02-03 4:27 ` Matthew Flaschen
2007-02-03 4:31 ` Matthew Flaschen [this message]
[not found] ` <mailman.3926.1170476834.2155.help-gnu-emacs@gnu.org>
2007-02-03 20:31 ` M G Berberich
2007-02-03 22:18 ` Pascal Bourguignon
-- strict thread matches above, loose matches on Subject: below --
2008-04-23 14:34 Neal Becker
[not found] <mailman.10741.1208961303.18990.help-gnu-emacs@gnu.org>
2008-04-23 15:59 ` Johan Bockgård
2008-04-23 16:04 ` tyler
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=45C41022.1020302@gatech.edu \
--to=matthew.flaschen@gatech.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.
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).