jed-users mailing list

[2009 Date Index] [2009 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: replace_match()


from: http://www.geocities.com/mmarko.geo/jedmacros/mmutil.sl.txt

% \usage{Int re_replace (String RegExpFind, String Replacement)}
%!% Replaces all occurences of strRegExpFind with strReplacement.
%!% strReplacement can include substrings from strRegExpFind.
%!% strRegExpFind is \0, first substring is \1, second is \2, etc.
%!% Example:
%!% input: ad e cf
%!%     re_replace ("\\([abc]\\)\\([def]\\)", "\\0:\\2\\1")
%!% output: ad:da e cf:fc
define re_replace (strRegExpFind, strReplacement)
{
   push_spot ();
   while (re_fsearch (strRegExpFind) > 0) {
      !if (replace_match (strReplacement, 0)) return (0);
   }
   pop_spot ();
   return (1);
}

Marko

G. Milde pravi:
Dear JED users,

The help for the intrinsic function replace_match() says:


 USAGE
  Int_Type replace_match(String_Type str, Int_Type method)

  ...
  If `method' is zero, `str' is a specially formatted string of the form
  described below.
  ...

However, the description of the special format is missing.

How can I format the (search pattern and) replacement string? to e.g.
only change "latin1" to "utf8" in

  re_fsearch("\\usepackage ?\[.*(latin1).*\] ?{inputenc}"R)

?

Günter

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.



--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2009 date index] [2009 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]