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

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

Re: regexp help


From: Matthew Flaschen
Subject: Re: regexp help
Date: Fri, 02 Feb 2007 23:31:30 -0500
User-agent: Thunderbird 1.5.0.9 (X11/20070103)

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: signature.asc
Description: OpenPGP digital signature


reply via email to

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