replace(string,pattern,replace_string[,original_string])

Description

Replaces the matched part of the string with the replace_string.
Last argument is logical, true or false, and if true returns the original string, if false returns an empty string.

Examples

replace(itt,"Rules","Expressions",true)
Returns the ITT except for the pattern matched "Rules" where the replacement string "Expressions" is returned.

replace(itt,"Rules","Expressions",false)
Returns a blank except for the pattern matched "Rules" where the replacement string "Expressions" is returned.

replace(ITT,"(w?)(\d{2})(\d{3})", "H:\20$2\$3",false)
Assuming the ITT contains "07328" the returned string is "h:\2007\328"
If the ITT contains any other value then nothing is returned, the last parameter is 'false', the default condition if left out.
If the last parameter is true the value of the ITT is returned.

replace([folder],"(?<=\d)\.\d+","",1)
The interger value of contents of folder "folder". (Actually, removes the period and ALL trailing numbers which follow another number.)


Related Rules

ireplace()