This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

StringReplaceList

StringReplaceList or StringReplaceList
gives a list of the strings obtained by replacing each individual occurrence of substrings in matching the string expressions .
StringReplaceList
gives a list of the first n results obtained.
StringReplaceList
gives the list of results for each of the .
  • The string expressions can contain any of the objects specified in the notes for StringExpression.
  • In each of the results returned by StringReplaceList only one substring has been replaced.
  • StringReplaceList 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, returning a result for each one that applies.
  • StringReplaceList in effect carries out a single step in the evolution of a multiway system.
  • In replacements of the form , the are not evaluated until each time they are used.
Make replacements for in all possible ways:
Make replacements for in all possible ways:
In[1]:=
Click for copyable input
Out[1]=
 
In[1]:=
Click for copyable input
Out[1]=
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:
Generate at most two possible results:
Replace occurrences of either string:
StringReplaceList works on special characters:
StringReplaceList automatically threads over lists of strings:
Make replacements for in all possible ways, including uppercase letters:
There are fewer results when taking case sensitivity into account:
Five steps in the evolution of the Fibonacci multiway system
Two steps in the evolution of another multiway system:
All possible replacements of the form :
StringReplaceList yields a StringExpression if the rule does not have a string result:
New in 5.1