RETAIN$ function

Purpose

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

Syntax

sResult$ = RETAIN$(mainstr$, [ANY] matchstr$)

Remarks

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

ANY

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

Restrictions

If matchstr$ 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"