ldmud-3.2.9/doc/
ldmud-3.2.9/doc/efun/
ldmud-3.2.9/mud/
ldmud-3.2.9/mud/heaven7/
ldmud-3.2.9/mud/heaven7/lib/
ldmud-3.2.9/mud/lp-245/
ldmud-3.2.9/mud/lp-245/banish/
ldmud-3.2.9/mud/lp-245/doc/
ldmud-3.2.9/mud/lp-245/doc/examples/
ldmud-3.2.9/mud/lp-245/doc/sefun/
ldmud-3.2.9/mud/lp-245/log/
ldmud-3.2.9/mud/lp-245/obj/Go/
ldmud-3.2.9/mud/lp-245/players/lars/
ldmud-3.2.9/mud/lp-245/room/death/
ldmud-3.2.9/mud/lp-245/room/maze1/
ldmud-3.2.9/mud/lp-245/room/sub/
ldmud-3.2.9/mud/lp-245/secure/
ldmud-3.2.9/mud/morgengrauen/
ldmud-3.2.9/mud/morgengrauen/lib/
ldmud-3.2.9/mud/sticklib/
ldmud-3.2.9/mud/sticklib/src/
ldmud-3.2.9/mudlib/uni-crasher/
ldmud-3.2.9/pkg/
ldmud-3.2.9/pkg/debugger/
ldmud-3.2.9/pkg/diff/
ldmud-3.2.9/pkg/misc/
ldmud-3.2.9/src/autoconf/
ldmud-3.2.9/src/bugs/
ldmud-3.2.9/src/bugs/MudCompress/
ldmud-3.2.9/src/bugs/b-020916-files/
ldmud-3.2.9/src/bugs/doomdark/
ldmud-3.2.9/src/bugs/ferrycode/ferry/
ldmud-3.2.9/src/bugs/ferrycode/obj/
ldmud-3.2.9/src/bugs/psql/
ldmud-3.2.9/src/done/
ldmud-3.2.9/src/done/order_alist/
ldmud-3.2.9/src/done/order_alist/obj/
ldmud-3.2.9/src/done/order_alist/room/
ldmud-3.2.9/src/gcc/
ldmud-3.2.9/src/gcc/2.7.0/
ldmud-3.2.9/src/gcc/2.7.1/
ldmud-3.2.9/src/hosts/
ldmud-3.2.9/src/hosts/GnuWin32/
ldmud-3.2.9/src/hosts/amiga/NetIncl/
ldmud-3.2.9/src/hosts/amiga/NetIncl/netinet/
ldmud-3.2.9/src/hosts/amiga/NetIncl/sys/
ldmud-3.2.9/src/hosts/i386/
ldmud-3.2.9/src/hosts/msdos/byacc/
ldmud-3.2.9/src/hosts/msdos/doc/
ldmud-3.2.9/src/hosts/os2/
ldmud-3.2.9/src/hosts/win32/
ldmud-3.2.9/src/util/
ldmud-3.2.9/src/util/erq/
ldmud-3.2.9/src/util/indent/hosts/next/
ldmud-3.2.9/src/util/xerq/
ldmud-3.2.9/src/util/xerq/lpc/
ldmud-3.2.9/src/util/xerq/lpc/www/
SYNOPSIS
        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, where bit 0 specifies
        that the search and replace should repeat as often as the
        pattern matches, and bit 1 (mask 2) specifies if the regular
        expressions are 'ex' compatible or not. 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...)

EXAMPLE
        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", #'lower_case, 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 efun and man page

SEE ALSO
        regexp(E), regexplode(E), sscanf(E), trim(E)