help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multiple search strings in query-replace-regexp


From: Florian Kaufmann
Subject: Re: multiple search strings in query-replace-regexp
Date: 6 Oct 2006 07:14:38 -0700
User-agent: G2/1.0

> Write a little function in *scratch* buffer with n replace-regexp,
> then load and apply it!

Yes, that's true. But I have to be careful that I take the nearest
match. Something like

saved_point = point
next_match_pos = INFINIT
for all regexes in regexlist {
  match_pos = search( current regex )
  if ( match_pos < next_match_pos ) {
    next_match_pos = match_pos
    regex_to_apply = current regex
  }
  goto saved_point
}
searc_replace( regex_to_apply )

Mhh, no, that doesn't work either. Now how should I implement the thing
that I can press all that query-replace keys like y n . etc? Of course
pressing y should advance to the nearest next match of any of the regex
from the regexlist.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]