From: Tyler Smith <tyler.smith@mail.mcgill.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: How does one avoid matching \n when matching all but whitespace?
Date: 08 Jul 2007 12:38:44 GMT [thread overview]
Message-ID: <slrnf91q71.kg2.tyler.smith@blackbart.mynetwork> (raw)
In-Reply-To: mailman.3168.1183840964.32220.help-gnu-emacs@gnu.org
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
next parent reply other threads:[~2007-07-08 12:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.3168.1183840964.32220.help-gnu-emacs@gnu.org>
2007-07-08 12:38 ` Tyler Smith [this message]
2007-07-07 19:59 How does one avoid matching \n when matching all but whitespace? ld1976
2007-07-07 21:26 ` Stephen Berman
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=slrnf91q71.kg2.tyler.smith@blackbart.mynetwork \
--to=tyler.smith@mail.mcgill.ca \
--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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.