From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jpkotta Newsgroups: gmane.emacs.help Subject: Re: replacing two consecutive words where the two words could be separated by multiple spaces or newlines. Date: Sat, 18 Apr 2009 21:43:53 -0700 (PDT) Organization: http://groups.google.com Message-ID: <00af68b0-6ded-4dcc-b0b6-46b027c505e7@c12g2000yqc.googlegroups.com> References: <23093020.post@talk.nabble.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1240159059 20565 80.91.229.12 (19 Apr 2009 16:37:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 19 Apr 2009 16:37:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 19 18:38:58 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Lva2j-0001Hu-BH for geh-help-gnu-emacs@m.gmane.org; Sun, 19 Apr 2009 18:38:57 +0200 Original-Received: from localhost ([127.0.0.1]:36461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lva1K-0006Gx-JN for geh-help-gnu-emacs@m.gmane.org; Sun, 19 Apr 2009 12:37:30 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!c12g2000yqc.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 32 Original-NNTP-Posting-Host: 96.18.60.209 Original-X-Trace: posting.google.com 1240116233 3008 127.0.0.1 (19 Apr 2009 04:43:53 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sun, 19 Apr 2009 04:43:53 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: c12g2000yqc.googlegroups.com; posting-host=96.18.60.209; posting-account=EwI0QQoAAADdqmqX_mVfawBNtwyks2YE User-Agent: G2/1.0 X-HTTP-UserAgent: Opera/9.64 (X11; Linux x86_64; U; en) Presto/2.1.1,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:168591 X-Mailman-Approved-At: Sun, 19 Apr 2009 12:37:05 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:63871 Archived-At: On Apr 17, 3:18=A0am, David Engster wrote: > Nobuko Three writes: > > I wanted to replace all occurrences of `a integer' with `an integer' in= a > > latex file. But a simple query replace would replace the first `a integ= er' > > of the following paragraph, but not the second one because the second o= ne is > > actually separated by a newline and two spaces (the indent). > > > =A0 This is a integer. That is a > > =A0 integer. ... > > > What is an automated way to change paragraphs like above to paragraphs = like > > below? > > > =A0 This is an integer. That is an > > =A0 integer. ... > > You can do this using regular expressions: > > M-x replace-regexp RET a\(\s-+\)integer RET an\1integer RET > > -David I was curious about the "\s-" because I've never seen such a thing. It sort of makes sense after RTFM, but it doesn't work all the time. Is it equivalent to "[[:space:]]"? Apparently, it depends on the major mode. "a\([[:space:]^J]+\)integer" works for me, where "^J" is C-q C-j.