* regexp help
@ 2007-02-02 23:20 gokhalen
2007-02-03 3:37 ` HS
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: gokhalen @ 2007-02-02 23:20 UTC (permalink / raw)
To: help-gnu-emacs
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
M-x replace-regexp RET hello \(......\)\1 RET hello \1 /*
NOTE: a white space follows the \1 */
Thanks,
-Nachiket.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: regexp help
2007-02-02 23:20 regexp help gokhalen
@ 2007-02-03 3:37 ` HS
2007-02-03 4:27 ` Matthew Flaschen
[not found] ` <mailman.3926.1170476834.2155.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 9+ messages in thread
From: HS @ 2007-02-03 3:37 UTC (permalink / raw)
To: help-gnu-emacs
On 2 fev, 20:20, gokha...@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
>
> M-x replace-regexp RET hello \(......\)\1 RET hello \1 /*
> NOTE: a white space follows the \1 */
>
> Thanks,
>
> -Nachiket.
There's no \d construct....
Can't you record a keyboard macro ? it might be easier!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: regexp help
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
[not found] ` <mailman.3926.1170476834.2155.help-gnu-emacs@gnu.org>
2 siblings, 1 reply; 9+ messages in thread
From: Matthew Flaschen @ 2007-02-03 4:27 UTC (permalink / raw)
To: emacs
[-- Attachment #1.1: Type: text/plain, Size: 712 bytes --]
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.
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
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <mailman.3926.1170476834.2155.help-gnu-emacs@gnu.org>]
* Re: regexp help
[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
1 sibling, 0 replies; 9+ messages in thread
From: M G Berberich @ 2007-02-03 20:31 UTC (permalink / raw)
To: help-gnu-emacs
On Fri, 02 Feb 2007, Matthew Flaschen <matthew.flaschen@gatech.edu> wrote:
> There may be some way to avoid repeating the [0-9] but I couldn't
> figure that out.
Regular Expressions can't count.
--
„Des is völlig wurscht, was heut beschlos- | M G Berberich
sen wird: I bin sowieso dagegn!“ | berberic@fmi.uni-passau.de
(SPD-Stadtrat Kurt Schindler; Regensburg) | www.fmi.uni-passau.de/~berberic
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: regexp help
[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
1 sibling, 0 replies; 9+ messages in thread
From: Pascal Bourguignon @ 2007-02-03 22:18 UTC (permalink / raw)
To: help-gnu-emacs
Matthew Flaschen <matthew.flaschen@gatech.edu> writes:
> 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.
\([0-9]\{6\}\)\([0-9]\{6\}\)
--
__Pascal Bourguignon__ http://www.informatimago.com/
The world will now reboot. don't bother saving your artefacts.
^ permalink raw reply [flat|nested] 9+ messages in thread
* regexp help
@ 2008-04-23 14:34 Neal Becker
0 siblings, 0 replies; 9+ messages in thread
From: Neal Becker @ 2008-04-23 14:34 UTC (permalink / raw)
To: help-gnu-emacs
I'm looking at outline mode.
I see outline-regexp is set to:
Its value is "[*\f]+"
Looking in emacs info, I see no reference to '\f'. What is it?
Looking at a buffer in C-mode, I see:
Its value is "[^#\n^M]"
I don't recognize the '#', what does this mean?
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <mailman.10741.1208961303.18990.help-gnu-emacs@gnu.org>]
* Re: regexp help
[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
1 sibling, 0 replies; 9+ messages in thread
From: Johan Bockgård @ 2008-04-23 15:59 UTC (permalink / raw)
To: help-gnu-emacs
Neal Becker <ndbecker2@gmail.com> writes:
> I see outline-regexp is set to:
> Its value is "[*\f]+"
>
> Looking in emacs info, I see no reference to '\f'. What is it?
Look it up in the Emacs Lisp manual (or do a full text search in the
Emacs manual).
?\f => 12 ; formfeed character, `C-l'
> Looking at a buffer in C-mode, I see:
> Its value is "[^#\n^M]"
>
> I don't recognize the '#', what does this mean?
Nothing special. It stands for itself.
--
Johan Bockgård
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: regexp help
[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
1 sibling, 0 replies; 9+ messages in thread
From: tyler @ 2008-04-23 16:04 UTC (permalink / raw)
To: help-gnu-emacs
Neal Becker <ndbecker2@gmail.com> writes:
> I'm looking at outline mode.
>
> I see outline-regexp is set to:
> Its value is "[*\f]+"
>
> Looking in emacs info, I see no reference to '\f'. What is it?
It's an escape character indicating a 'formfeed'.
>
> Looking at a buffer in C-mode, I see:
> Its value is "[^#\n^M]"
>
> I don't recognize the '#', what does this mean?
>
Sometimes a hash is just a hash. I'm not sure what the context is here,
but maybe it has something to do with recognising #include and #define
in c code.
HTH,
Tyler
--
Friends don't let friends send Word documents
http://www.nothingisreal.com/dfki/no-word
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-04-23 16:04 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
[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
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).