[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How does one avoid matching \n when matching all but whitespace?
From: |
Stephen Berman |
Subject: |
Re: How does one avoid matching \n when matching all but whitespace? |
Date: |
Sat, 07 Jul 2007 23:26:10 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) |
On Sat, 7 Jul 2007 12:59:31 -0700 (PDT) ld1976 <lior_dagan@yahoo.com> wrote:
> Hello all. This is a rookie's question.
> I am trying to a simple text regular expression replacement.
> The text goes as follows (white spaces may change:
> tcl_cmd bla > kuku
> I want to change it to:
> tcl_cmd bla > kuku.rev1
> When trying to use replace-regexp \(>[ ]+[^ ]+\) to \1.rev1 I get:
> tcl_cmd bla > kuku
> .rev1
> This is quiet different than using the \W+ with perl...
> I think that emacs matches within [^ ]+ \n too. Trying to use [^ \n]+ did
> not solve the issue either.
With replace-regexp you need to type C-q C-j instead of \n to match a
newline. (Emacs 22.1 gives you a hint to that effect when you type
`\n' in the regexp.)
Steve Berman