CalcIt Commands

REREPLACE(av, Expr1, Expr2)

Is the regular expressions version of command REPLACE. Finds all sub strings they match Expr1 inside variable av and replaces them with Expr2. Searching is case sensitive. Expr1 is a regular expression.

NOTE: To use a replace string (Expr2) which is adapted and composed with the each time found sub string we can use the constant MATCH to represent the found string in the replace string. e.g.

a:='Put the following numbers in parentheses: 1000, 100, 300';

After the execution of the above code the following will be printed:

Put the following numbers in parentheses: (1000), (100), (300)

See REPLACE, Regular expressions

See also an alternative more powerful version of this command below.

REREPLACE(av, Expr1, ReplaceFunction)

If you need the maximum flexibility in find and replace use this version of REReplace command. Instead of a replace string parameter takes a local function which is used in the replace process. This function must have only one normal (IN) parameter. Every time REReplace call this function it passes in its parameter the currently matched string and expects from the user to return the replacement for it. e.g.

a:='The most powerful computer of the world';

function ReplaceStr(s);


Go Back