Update doc/efun/ aus Driversourcen.
Manpages der efuns aktualisiert, neue Manpages hinzugefuegt.
Change-Id: I7cc91684269ff56d1aef47d5c5e7c87f7fd531dc
diff --git a/doc/efun/regreplace b/doc/efun/regreplace
index e0e7cf3..912e864 100644
--- a/doc/efun/regreplace
+++ b/doc/efun/regreplace
@@ -1,51 +1,61 @@
-SYNOPSIS
- string regreplace(string txt, string pattern,
- string|closure replacepattern, int flags)
-
-BESCHREIBUNG
- Die Funktion durchsucht den String txt nach einem Vorkommen
- des regulaeren Ausdrucks pattern, und ersetzt ihn durch
- den String replacepattern. (replacepattern kann auch eine Closure
- sein. Sie bekommt als argument den passenden Substring und muss
- den Ersatzstring zurueckliefern.)
-
- Im replacestring kann man via '&' auf den zum Suchausdruck
- passenden Teilstring im Original zugreifen. Mit \n (wobei n
- eine Ganzzahl ist) kann man auf den n-ten Unterausdruck
- des regulaeren Ausdrucks zugreifen. Um "&" oder "\\1" als
- Ersetzung zu erreichen, muss "\\&" bzw "\\\\1" verwendet werden.
-
- Beim Flag bestimmt ein gesetztes Bit 0, dass der Ausdruck so oft
- wie vorhanden ersetzt wird, sonst nur das erste Auftreten.
- Bit 1 bestimmt, ob der regulaere Ausdruck 'ed' oder 'sed' kompatibel
- ist (Bit geloescht) oder 'ex' kompatibel (gesetzt).
-
- Die Funktion wirkt wie s/pattern/replacepattern/flags in
- Editoren wie vi oder sed. Sie ist besonders gut geeignet um
- variable Strings zu ersetzen, im Gegensatz zu regexplode, wo
- man den String nur nach einem regulaeren Ausdruck zerlegen kann.
-
-BEISPIELE
- string msgin;
-
- /* Sucht nach 'teilt Dir mit: ' und schliesst den nachfolgenden
- ** Text mit <underline> und </underline> ein; bei jedem Auftreten.
- */
- msgin = regreplace(msgin, "teilt Dir mit: (.*)",
- "teilt Dir mit: <underline>\\1</underline>", 1);
-
- /* Ersetzt die <underline> html-Tags durch die vt100
- ** Escape-Sequenzen fuer Unterstreichung
- */
- txt = regreplace(txt, "<underline>", "<ESC>[5m", 1);
-
- /* Ersetzt das Wort HOUSE in Kleinbuchstaben. */
- txt = regreplace(txt, "HOUSE",
- function string (string s) {return lower_case(s);},
- 1);
-
-AUTOR
- Marcus@TAPPMud schrieb die Original-efun (und die englische Manpage).
-
-SIEHE AUCH
- regexp(E), regexplode(E), sscanf(E)
+SYNOPSIS
+ #include <regexp.h>
+
+ string regreplace(string txt, string pattern,
+ closure|string replacepattern, int flags)
+
+DESCRIPTION
+ This function looks through txt looking for the regular
+ expression pattern. If it finds it, it replaces it by the
+ replacepattern.
+
+ The replacepattern can be a constant string, or a closure taking
+ the matched substring and the position at which it was found
+ as arguments and returning the replacement pattern string.
+
+ The flag is a bitmask of the usual regexp options. Additionally
+ the efun recognizes RE_GLOBAL: if set, the search and replace
+ is repeated as often as the pattern matches.
+
+ The function returns the modified string (or the original if it
+ wasn't modified).
+
+ The function behaves like the s/pattern/replacepattern/flags
+ in editors as ed/vi or sed. The power of this function lies in
+ replacing variable strings (as opposed to regexplode, where
+ you can explode by regular expression, but not implode...)
+
+
+EXAMPLES
+ string msgin;
+
+ /* Checks msgin for the string 'tells you: ' and all following
+ * characters and encloses those characters by <underline>
+ * and </underline>. global.
+ */
+ msgin = regreplace(msgin, "tells you: (.*)",
+ "tells you: <underline>\\1</underline>", 1);
+
+ /* replaces all <underline> html tags by the vt100 escape
+ * sequence for underline.
+ */
+ txt = regreplace(txt, "<underline>", "<ESC>[5m", 1);
+
+ /* Put the word HOUSE into lower case. */
+ txt = regreplace(txt, "HOUSE",
+ function string (string s) {return lower_case(s);},
+ 1);
+
+
+HISTORY
+ Introduced in 3.2.1@125.
+ The use of a closure as replacepattern was introduced in
+ LDMud 3.2.9.
+
+AUTHOR
+ Marcus@TAPPMud contributed the original idea for the efun and the
+ man page.
+
+SEE ALSO
+ regexp(E), regexplode(E), regmatch(E), regexp_package(E),
+ sscanf(E), trim(E), regexp(C)