all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: bitterspetey <business@stevepetersen.net>
To: Help-gnu-emacs@gnu.org
Subject: Re: replacing phrases: matching line feeds in regular expressions, since \s- doesn't work
Date: Sat, 18 Feb 2012 15:30:39 -0800 (PST)	[thread overview]
Message-ID: <33350095.post@talk.nabble.com> (raw)
In-Reply-To: <87ehts2ayk.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 992 bytes --]


Thanks for the suggestions so far!


query-replace does not seem to work across newlines (to my surprise).


foo[\s^J]bar also does not work; I thought \s- was supposed to match any
whitespace, including newline, and not be interpreted as part of a range in
this case.


This one below does work, and thank you!  But as you say, it's kludgy. Is
this really the best emacs can do to replace a phrase?!  Why doesn't \s-
work in this context? Is there no way to match any whitespace?


Jeremiah Dodds wrote:
> 
> The following works for me with the words separated by arbitrary
> whitespace including newlines (although it is ugly, and I'm sure there's
> better ways to do it):
> 
> M-x replace-regexp foo[ ^TAB^j]*bar[ ^TAB^j]*baz[ ^TAB^j] RET fbb RET
> 
-- 
View this message in context: http://old.nabble.com/replacing-phrases%3A-matching-line-feeds-in-regular-expressions%2C-since-%5Cs--doesn%27t-work-tp33349186p33350095.html
Sent from the Emacs - Help mailing list archive at Nabble.com.

[-- Attachment #2: Type: text/html, Size: 1452 bytes --]

  parent reply	other threads:[~2012-02-18 23:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-18 17:52 replacing phrases: matching line feeds in regular expressions, since \s- doesn't work Steve Petersen
2012-02-18 19:17 ` Thorsten
2012-02-18 19:33 ` jeremiah.dodds
2012-02-18 20:44   ` Peter Dyballa
2012-02-19  2:47     ` jeremiah.dodds
2012-02-18 23:30   ` bitterspetey [this message]
2012-02-19  0:15 ` Eric Abrahamsen
  -- strict thread matches above, loose matches on Subject: below --
2012-02-18 21:26 Silvio Levy
2012-02-19  3:04 ` jeremiah.dodds

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=33350095.post@talk.nabble.com \
    --to=business@stevepetersen.net \
    --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.