Wolfram Language & System 10.4 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)


replaces the string expression s by sp wherever it appears in .

replaces the string expressions by whenever they appear as substrings of .

does only the first n replacements.

gives the list of results for each of the .

represents an operator form of StringReplace that can be applied to an expression.

Details and OptionsDetails and Options

  • 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.
  • If the in the replacements do not evaluate to strings, StringReplace will yield a StringExpression rather than an ordinary string.
  • In replacements of the form , the are not evaluated until each time they are used.
  • Setting the option IgnoreCase->True makes StringReplace treat lowercase and uppercase letters as equivalent.
  • StringReplace[srules][expr] is equivalent to StringReplace[expr,srules].
Introduced in 1991
| Updated in 2016