Skip to main content

Replacex

Replacex (Function)

Formato

replacex ( haystack_string_expression , regular_expression , string_expression )

returns string_expression

Description

Return a new string where all occurrences of substrings matching the regular expression regular_expression are replaced by string_expression in the string haystack_string_expression.

Example

a$ = "Ouvi bossa e saí da fossa"
print Replacex(a$,"bossa","sopa")
print Replacex(a$, "[bf]ossa", "sopa")

will display

Ouvi sopa e saí da fossa
Ouvi sopa e saí da sopa

Notes

By default the nature of regular expressions is “greedy”. This behaviour can be changed using the RegexMinimal statement.

See Also

Asc, Chr, Count, Countx, Explode, Explodex, Implode, Instr, Instrx, Left, Length, Ljust, Lower, LTrim, MD5, Mid, Midx, Replace, Replacex, Right, Rjust, RTrim, Serialize, String, Trim, Unserialize, Upper, Zfill

History

0.9.6.56New to Version