This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.

# StringReplace

 StringReplace or StringReplacereplaces the string expressions by whenever they appear as substrings of . StringReplacedoes only the first n replacements. StringReplacegives the list of results for each of the .
• The string expressions can contain any of the objects specified in the notes for StringExpression.
• StringReplace goes through a string, testing substrings that start at each successive character position. On each substring, it tries in turn each of the transformation rules you have specified. If any of the rules apply, it replaces the substring, then continues to go through the string, starting at the character position after the end of the substring.
• In replacements of the form , the are not evaluated until each time they are used.
Replace every occurrence of "ab" with "X":
Replace every substring that has one or more occurrences of "ab" with "X":
Replace every occurrence of "ab" with "X":
 Out[1]=

Replace every substring that has one or more occurrences of "ab" with "X":
 Out[1]=
 Scope   (9)
Use string patterns:
Use a regular expression:
Use pattern matching for dates:
Mixed regular expressions and string patterns:
Use RuleDelayed () in order to evaluate the right-hand side of a rule:
Replace only the two first occurrences that match the given pattern:
Replace occurrences of either string:
StringReplace works on special characters:
StringReplace automatically threads over lists of strings:
Replacements can be nonstrings:
 Options   (1)
This replaces all occurrences regardless of case:
 Applications   (7)