Error getting tags :
error 404Error getting tags :
error 404 replaceText | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
replaceText
Basics
Expander triangle
Type
Function
Syntax

replaceText(stringToChange,matchExpression,replacementString)

Introduced
1.0
Environment
Desktop,Server,Web
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Searches for a regular expression and replaces the portions that match the regular expression.
Examples

replaceText("malformed","mal","well") -- returns "wellformed"

replaceText(field "Stats",return,comma) -- makes comma-delimited

Additional Comments
Expander triangle

Use the replaceText function to search for and replace text that matches a particular pattern.

Parameters:

The stringToChange is any expression that evaluates to a string.

The matchExpression is a regular expression.

The replacementString is any expression that evaluates to a string.

Value:

The replaceText function returns the changed string.

Comments:

The replaceText function replaces all the occurrences of the matchExpression with the replacementString. If more than one matching substring is found, the replaceText function replaces all of them.

The replaceText function is not as fast as the replace command, but is more flexible because you can search for any text that matches a regular expression.

The stringToChange and matchExpression are always case-sensitive, regardless of the setting of the caseSensitive property. (If you need to make a case-insensitive comparison, use "(?i)" at the start of the matchExpression to make the match case-insensitive.)

Note that a number of characters in regular expressions have special meanings and need to be escaped with back slashes For example period (".") matches any character, so in order to replace period characters with a regular expression use "\." . For more information on regular expressions see the Perl documentation here: <http://perldoc.perl.org/perlre.html>

User Comments
Expander triangle
User thumbnail
EricMColvin@telus.net
StarStarStarStarStar
Dec 18, 2009
Certain characters appear to be reserved in <i>matchExpression</i>, for some reason.
If you have a "$" character, or a "+" character, precede them with the "\" character for them to read normally.
For example: replaceText("35+17 - 27", "\+1", "0") -- returns "3507 - 27"