RETAIN$ function

Purpose

Return a string containing only the characters contained in a specified match string.  All other characters are removed..

Syntax

sResult$ = RETAIN$(main$, [ANY] match$)

Remarks

RETAIN$ returns a string consisting of zero or more copies of the complete expression match$ which are found in main$.  All other characters are removed.

ANY

If the ANY option is included, match$ specifies a list of single characters to be retained, if they are found in main$.

Restrictions

If match$ is an empty string, RETAIN$ returns an empty string.

See also

EXTRACT$, REMAIN$, REMOVE$, REPLACE

Example

a$ ="<p>1234567890<ak;lk;l>1234567890</p>"

b$ = RETAIN$(a$, ANY "<;/p>")

c$ = RETAIN$(a$, ANY "0123456789")

Result

b$ contains "<p><;;></p>"

c$ contains " 12345678901234567890"