* replacing two consecutive words where the two words could be separated by multiple spaces or newlines.
@ 2009-04-17 8:06 Nobuko Three
2009-04-17 8:18 ` David Engster
[not found] ` <mailman.5514.1239956322.31690.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 4+ messages in thread
From: Nobuko Three @ 2009-04-17 8:06 UTC (permalink / raw)
To: Help-gnu-emacs
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 integer'
of the following paragraph, but not the second one because the second one is
actually separated by a newline and two spaces (the indent).
This is a integer. That is a
integer. ...
What is an automated way to change paragraphs like above to paragraphs like
below?
This is an integer. That is an
integer. ...
--
View this message in context: http://www.nabble.com/replacing-two-consecutive-words-where-the-two-words-could-be-separated-by-multiple-spaces-or-newlines.-tp23093020p23093020.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: replacing two consecutive words where the two words could be separated by multiple spaces or newlines.
2009-04-17 8:06 replacing two consecutive words where the two words could be separated by multiple spaces or newlines Nobuko Three
@ 2009-04-17 8:18 ` David Engster
[not found] ` <mailman.5514.1239956322.31690.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 4+ messages in thread
From: David Engster @ 2009-04-17 8:18 UTC (permalink / raw)
To: help-gnu-emacs
Nobuko Three <nbko3@yahoo.com> 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 integer'
> of the following paragraph, but not the second one because the second one is
> actually separated by a newline and two spaces (the indent).
>
>
> This is a integer. That is a
> integer. ...
>
> What is an automated way to change paragraphs like above to paragraphs like
> below?
>
> This is an integer. That is an
> integer. ...
You can do this using regular expressions:
M-x replace-regexp RET a\(\s-+\)integer RET an\1integer RET
-David
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: replacing two consecutive words where the two words could be separated by multiple spaces or newlines.
[not found] ` <mailman.5514.1239956322.31690.help-gnu-emacs@gnu.org>
@ 2009-04-19 4:43 ` jpkotta
2009-04-21 1:01 ` Kevin Rodgers
0 siblings, 1 reply; 4+ messages in thread
From: jpkotta @ 2009-04-19 4:43 UTC (permalink / raw)
To: help-gnu-emacs
On Apr 17, 3:18 am, David Engster <d...@randomsample.de> wrote:
> Nobuko Three <nb...@yahoo.com> 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 integer'
> > of the following paragraph, but not the second one because the second one is
> > actually separated by a newline and two spaces (the indent).
>
> > This is a integer. That is a
> > integer. ...
>
> > What is an automated way to change paragraphs like above to paragraphs like
> > below?
>
> > This is an integer. That is an
> > 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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: replacing two consecutive words where the two words could be separated by multiple spaces or newlines.
2009-04-19 4:43 ` jpkotta
@ 2009-04-21 1:01 ` Kevin Rodgers
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2009-04-21 1:01 UTC (permalink / raw)
To: help-gnu-emacs
jpkotta wrote:
> On Apr 17, 3:18 am, David Engster <d...@randomsample.de> wrote:
>> You can do this using regular expressions:
>>
>> M-x replace-regexp RET a\(\s-+\)integer RET an\1integer RET
>
> 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.
Of course :-)
> "a\([[:space:]^J]+\)integer" works for me, where "^J" is C-q C-j.
I think that newline has comment-ender syntax (not whitespace-character)
in some major modes.
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-04-21 1:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-17 8:06 replacing two consecutive words where the two words could be separated by multiple spaces or newlines Nobuko Three
2009-04-17 8:18 ` David Engster
[not found] ` <mailman.5514.1239956322.31690.help-gnu-emacs@gnu.org>
2009-04-19 4:43 ` jpkotta
2009-04-21 1:01 ` Kevin Rodgers
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.