* search and replace
@ 2004-07-03 20:57 David Rasmussen
2004-07-03 23:02 ` Mike Ballard
2004-07-03 23:04 ` Mike Ballard
0 siblings, 2 replies; 14+ messages in thread
From: David Rasmussen @ 2004-07-03 20:57 UTC (permalink / raw)
I am trying with query replace to replace
\ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]
with
\traverse
but it just replaces 0 occurrences. I don't understand why.
Do I have to do anything special? Is it because the string contains
special characters or ... ?
/David
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: search and replace
2004-07-03 20:57 search " David Rasmussen
@ 2004-07-03 23:02 ` Mike Ballard
2004-07-27 23:06 ` David Combs
2004-07-03 23:04 ` Mike Ballard
1 sibling, 1 reply; 14+ messages in thread
From: Mike Ballard @ 2004-07-03 23:02 UTC (permalink / raw)
On Sat Jul 03, I was peacefully napping until David Rasmussen said:
> I am trying with query replace to replace
>
> \ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]
>
> with
>
> \traverse
>
> but it just replaces 0 occurrences. I don't understand why.
>
> Do I have to do anything special? Is it because the string contains special characters
> or ... ?
No. Most likely. Did you try partial searches up to say the "," and/or
the "-"? "-" (at the least) need to be escaped...
Mike
--
mikeballard at symbol verizon period net
"If your main parachute fouls, deploy your reserve. If your
reserve is also fouled you have the rest of your life to get
it straightened out."
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: search and replace
2004-07-03 20:57 search " David Rasmussen
2004-07-03 23:02 ` Mike Ballard
@ 2004-07-03 23:04 ` Mike Ballard
2004-07-03 23:07 ` David Rasmussen
1 sibling, 1 reply; 14+ messages in thread
From: Mike Ballard @ 2004-07-03 23:04 UTC (permalink / raw)
On Sat Jul 03, I was peacefully napping until David Rasmussen said:
> I am trying with query replace to replace
>
> \ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]
>
> with
>
> \traverse
>
> but it just replaces 0 occurrences. I don't understand why.
>
> Do I have to do anything special? Is it because the string contains special characters
> or ... ?
>
Sorry - I missed the first "\" and "[" - those mean something in regexps
so they need to be escaped as well...
Mike
--
mikeballard at symbol verizon period net
"If your main parachute fouls, deploy your reserve. If your
reserve is also fouled you have the rest of your life to get
it straightened out."
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: search and replace
2004-07-03 23:04 ` Mike Ballard
@ 2004-07-03 23:07 ` David Rasmussen
2004-07-04 9:14 ` Ole Laursen
2004-07-04 23:32 ` Mike Ballard
0 siblings, 2 replies; 14+ messages in thread
From: David Rasmussen @ 2004-07-03 23:07 UTC (permalink / raw)
Mike Ballard wrote:
> On Sat Jul 03, I was peacefully napping until David Rasmussen said:
>
> Sorry - I missed the first "\" and "[" - those mean something in regexps
> so they need to be escaped as well...
>
I didn't think M-% (query and replace) worked on regexps. Is there a way
to do search on replace on raw text, not regexps?
/David
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: search and replace
2004-07-03 23:07 ` David Rasmussen
@ 2004-07-04 9:14 ` Ole Laursen
2004-07-04 9:27 ` David Rasmussen
2004-07-04 23:32 ` Mike Ballard
1 sibling, 1 reply; 14+ messages in thread
From: Ole Laursen @ 2004-07-04 9:14 UTC (permalink / raw)
David Rasmussen <david.rasmussen@gmx.net> writes:
[...]
> I didn't think M-% (query and replace) worked on regexps. Is there a
> way to do search on replace on raw text, not regexps?
You were right in your thinking - it doesn't work on regexps. I tried
copying the
\ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]
into *scratch* and used M-% to query-replace it with \traverse. It
works fine here. Remember that if you place the cursor on top of the
above line, Emacs won't find it. You need to place the cursor before the
line for Emacs to find it.
--
Ole Laursen
http://www.cs.aau.dk/~olau/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: search and replace
2004-07-04 9:14 ` Ole Laursen
@ 2004-07-04 9:27 ` David Rasmussen
2004-07-04 15:51 ` Ole Laursen
2004-07-04 16:02 ` Josh Howard
0 siblings, 2 replies; 14+ messages in thread
From: David Rasmussen @ 2004-07-04 9:27 UTC (permalink / raw)
Ole Laursen wrote:
>
> You were right in your thinking - it doesn't work on regexps. I tried
> copying the
>
> \ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]
>
> into *scratch* and used M-% to query-replace it with \traverse. It
> works fine here. Remember that if you place the cursor on top of the
> above line, Emacs won't find it. You need to place the cursor before the
> line for Emacs to find it.
>
Hmm. I had a file containing something like:
\ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]{a}{b}
\ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]{b}{c}
\ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]{c}{d}
\ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]{d}{e}
\ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]{e}{f}
\ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]{f}{g}
And I did M-% to replace
\ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]
with
\traverse
The cursor was before any of these line (and even if not, the search
wraps around anyway, doesn't it?). It just said "0 occurences replaced".
I don't understand why... I had to use another editor to perform the
replace :(
/David
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: search and replace
2004-07-04 9:27 ` David Rasmussen
@ 2004-07-04 15:51 ` Ole Laursen
2004-07-04 16:02 ` Josh Howard
1 sibling, 0 replies; 14+ messages in thread
From: Ole Laursen @ 2004-07-04 15:51 UTC (permalink / raw)
David Rasmussen <david.rasmussen@gmx.net> writes:
[...]
> Hmm. I had a file containing something like:
>
> \ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]{a}{b}
> \ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]{b}{c}
> \ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]{c}{d}
> \ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]{d}{e}
> \ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]{e}{f}
> \ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]{f}{g}
>
> And I did M-% to replace
> \ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]
> with
> \traverse
>
> The cursor was before any of these line (and even if not, the search
> wraps around anyway, doesn't it?). It just said "0 occurences
> replaced".
No, it never wraps around.
> I don't understand why... I had to use another editor to perform the
> replace :(
I tried those lines too, and it still works as expected. Someone
strange must have happened.
--
Ole Laursen
http://www.cs.aau.dk/~olau/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: search and replace
2004-07-04 9:27 ` David Rasmussen
2004-07-04 15:51 ` Ole Laursen
@ 2004-07-04 16:02 ` Josh Howard
1 sibling, 0 replies; 14+ messages in thread
From: Josh Howard @ 2004-07-04 16:02 UTC (permalink / raw)
David Rasmussen <david.rasmussen@gmx.net> writes:
> The cursor was before any of these line (and even if not, the search
> wraps around anyway, doesn't it?). It just said "0 occurences
> replaced".
It doesn't wrap around by default. Putting the cursor on the line
above \ncline certainly works here. I am running Emacs out of CVS
from a month or two ago. Perhaps there was a bug in a released
version? I do consider the fact that you can't do the replace on the
line in question a bug, but otherwise it does seem to work.
--
Josh Howard <jrh@zeppelin.net>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: search and replace
2004-07-03 23:07 ` David Rasmussen
2004-07-04 9:14 ` Ole Laursen
@ 2004-07-04 23:32 ` Mike Ballard
1 sibling, 0 replies; 14+ messages in thread
From: Mike Ballard @ 2004-07-04 23:32 UTC (permalink / raw)
On Sun Jul 04, I was peacefully napping until David Rasmussen said:
> Mike Ballard wrote:
> > On Sat Jul 03, I was peacefully napping until David Rasmussen said:
> > Sorry - I missed the first "\" and "[" - those mean something in regexps
> > so they need to be escaped as well...
> >
>
> I didn't think M-% (query and replace) worked on regexps. Is there a way to do search
> on replace on raw text, not regexps?
>
My apologies :-) The trouble with remapped keys is you remember what they
do but forgot what they are. I use 'query replace regexp' in place of
'query replace'...
Mike
--
mikeballard at symbol verizon period net
"If your main parachute fouls, deploy your reserve. If your
reserve is also fouled you have the rest of your life to get
it straightened out."
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: search and replace
2004-07-03 23:02 ` Mike Ballard
@ 2004-07-27 23:06 ` David Combs
0 siblings, 0 replies; 14+ messages in thread
From: David Combs @ 2004-07-27 23:06 UTC (permalink / raw)
In article <m2zn6g8wsw.fsf@west_f1.net>,
Mike Ballard <dont_w@nt_spam.org> wrote:
>
>On Sat Jul 03, I was peacefully napping until David Rasmussen said:
>
>> I am trying with query replace to replace
>>
>> \ncline[linewidth=0.3mm,offset=-1.5mm,arrows=->,nodesep=4mm]
>>
> ... "-" (at the least) need to be escaped...
Hyphen have to be escaped? Know of a situation where that-s
true?
Maybe it was a typo, and instead meant the square-brackets (for
char-class)?
Thanks!
David
^ permalink raw reply [flat|nested] 14+ messages in thread
* Search and replace
@ 2008-06-13 21:09 tho643
2008-06-13 21:59 ` Marc Tfardy
0 siblings, 1 reply; 14+ messages in thread
From: tho643 @ 2008-06-13 21:09 UTC (permalink / raw)
To: help-gnu-emacs
Here's an example of what I'm trying to do in my emacs console:
me@your-domain.com
you@my-domain.com
this@no-domain.com
Now after a search and replace this is what I want to get:
your-domain.com
my-domain.com
no-domain.com
I do not konw how to get rid of the 'me' 'you' 'this' and '@' in one
search and replace command. I know how to change the @, but how would
be able to delete it, and everything else that happens to come before
it, on the same line. I hope this makes sense to you.
Thanks
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Search and replace
2008-06-13 21:09 Search and replace tho643
@ 2008-06-13 21:59 ` Marc Tfardy
2008-06-14 3:13 ` Barry Margolin
0 siblings, 1 reply; 14+ messages in thread
From: Marc Tfardy @ 2008-06-13 21:59 UTC (permalink / raw)
To: help-gnu-emacs
tho643@gmail.com schrieb:
> Here's an example of what I'm trying to do in my emacs console:
>
> me@your-domain.com
> you@my-domain.com
> this@no-domain.com
>
> Now after a search and replace this is what I want to get:
>
> your-domain.com
> my-domain.com
> no-domain.com
>
> I do not konw how to get rid of the 'me' 'you' 'this' and '@' in one
> search and replace command. I know how to change the @, but how would
> be able to delete it, and everything else that happens to come before
> it, on the same line. I hope this makes sense to you.
M-x replace-regexp RET .+@\(.*\) RET \1
But this macro do the same job:
C-a ;; move-beginning-of-line
C-SPC ;; set-mark-command
C-s ;; isearch-forward
@ ;; self-insert-command
RET ;; newline
C-w ;; kill-region
C-n ;; next-line
and than C-x C-k r on region
:-)
regards
Marc
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Search and replace
2008-06-13 21:59 ` Marc Tfardy
@ 2008-06-14 3:13 ` Barry Margolin
2008-06-14 10:48 ` Marc Tfardy
0 siblings, 1 reply; 14+ messages in thread
From: Barry Margolin @ 2008-06-14 3:13 UTC (permalink / raw)
To: help-gnu-emacs
In article <6bg8udF3cavbgU1@mid.individual.net>,
Marc Tfardy <m-t-o___CUT__IT@web.de> wrote:
> tho643@gmail.com schrieb:
> > Here's an example of what I'm trying to do in my emacs console:
> >
> > me@your-domain.com
> > you@my-domain.com
> > this@no-domain.com
> >
> > Now after a search and replace this is what I want to get:
> >
> > your-domain.com
> > my-domain.com
> > no-domain.com
> >
> > I do not konw how to get rid of the 'me' 'you' 'this' and '@' in one
> > search and replace command. I know how to change the @, but how would
> > be able to delete it, and everything else that happens to come before
> > it, on the same line. I hope this makes sense to you.
>
> M-x replace-regexp RET .+@\(.*\) RET \1
Even simpler:
M-x replace-regexp RET .+@ RET RET
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Search and replace
2008-06-14 3:13 ` Barry Margolin
@ 2008-06-14 10:48 ` Marc Tfardy
0 siblings, 0 replies; 14+ messages in thread
From: Marc Tfardy @ 2008-06-14 10:48 UTC (permalink / raw)
To: help-gnu-emacs
Barry Margolin schrieb:
> In article <6bg8udF3cavbgU1@mid.individual.net>,
>> M-x replace-regexp RET .+@\(.*\) RET \1
>
> Even simpler:
>
> M-x replace-regexp RET .+@ RET RET
Indeed! :)
regards
Marc
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2008-06-14 10:48 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-13 21:09 Search and replace tho643
2008-06-13 21:59 ` Marc Tfardy
2008-06-14 3:13 ` Barry Margolin
2008-06-14 10:48 ` Marc Tfardy
-- strict thread matches above, loose matches on Subject: below --
2004-07-03 20:57 search " David Rasmussen
2004-07-03 23:02 ` Mike Ballard
2004-07-27 23:06 ` David Combs
2004-07-03 23:04 ` Mike Ballard
2004-07-03 23:07 ` David Rasmussen
2004-07-04 9:14 ` Ole Laursen
2004-07-04 9:27 ` David Rasmussen
2004-07-04 15:51 ` Ole Laursen
2004-07-04 16:02 ` Josh Howard
2004-07-04 23:32 ` Mike Ballard
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.