[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [h-e-w] search and replace across lines
From: |
Peter Davis |
Subject: |
Re: [h-e-w] search and replace across lines |
Date: |
25 Apr 2002 16:21:07 +0000 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 |
Lance Johnston <address@hidden> writes:
> Hi,
>
> I'm wondering how I can do a search and replace across lines in
> emacs.
Use C-q to "quote" your newline characters, so you can actually
include them in search strings. For example ...
> For example, let's say I have the following text in a file:
>
> constant_text variable_text
> {
> ...
>
> And I want to turn this into:
>
> constant_text variable_text
> {
> added_text
> ...
Search for: \(constant_text <regexp for variable_text>^J{^J\)
Replace with: \1added_text
Note that the ^J's in the search string are added by typing C-q C-j.
> After trying for a while to get this to work, I think this question
> can be simplified to "How can I search across lines?", as I can't
> even get a search expression to span lines.
Think of it as "How do I include a newline in my search string?"
-pd
--
--------
Peter Davis
Funny stuff at http://www.pfdstudio.com
The artwork formerly shown as prints
List of resources for children's writers and illustrators at:
http://www.pfdstudio.com/cwrl.html