[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: |
Tyler Smith |
Subject: |
Re: How does one avoid matching \n when matching all but whitespace? |
Date: |
08 Jul 2007 12:38:44 GMT |
User-agent: |
slrn/0.9.8.1pl1 (Debian) |
On 2007-07-07, 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...
You could do it (almost) the same way you'd do it in perl:
'\(> +\w+\)' to '\1.rev1'
You can also use '$' to explicitly signal the end of line, which is
helpful if you have other incidences of '> ' that occur earlier in the
line:
'\(> +\w+\)$' to '\1.rev1'
HTH,
Tyler