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

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

Re: [h-e-w] Help with regexp's


From: David Vanderschel
Subject: Re: [h-e-w] Help with regexp's
Date: 29 Jun 2004 01:54:41 -0500

On Monday, June 28, "David Arnold" <address@hidden> wrote:
>I have many environments in a large document similar to:

>\align
> 0.05P-1000&=0\cr
> P&=20000.
>\endalign

>I'd like to know how to write a regular expression that would select this
>environment, then replace it with:

>\begin{aligned}
> 0.05P-1000&=0\cr
> P&=20000.
>\end{aligned}

As far as I can tell from what you have written, all
you are doing is replacing all occurences of "\align"
with "\begin{aligned}" and of "\endalign" with
"\end{aligned}".  If so, I don't see why you have
posed this as a regexp question.  (OTOH, I am not
saying, "Don't use query-replace-regexp.", as that can
assure that the strings are replaced only when they
occur at the beginning of a line; but this is hardly a
major regexp issue.)  Since it seems trivial at this
point, there is probably something about the nature of
your problem which you are not stating.  I do not
really understand the way you are using the word
"environments" or how such environments relate to the
problem.


This list is intended for help with emacs issues which
are specific to the Windows port of emacs.  Your
question is not specific in this sense.  For such
questions, you are encouraged to post them in the more
general Usenet forum, gnu.emacs.help.  In that forum
there are more folks to help and more who can benefit
from reading any responses you may get.


Nevertheless, now that we are here, see if the
following does what you want:

  (query-replace-regexp "^\\\\begin" "\\\\begin{aligned}" nil)

When entering that interactively, you only need to
quote the \'s once.  If it looks like it is working
OK, hit !  to do the rest without query.


Regards,
  David V.





reply via email to

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