StringReplaceList
✖
StringReplaceList
gives a list of the strings obtained by replacing each individual occurrence of substrings in "string" matching the string expressions si.
Details and Options

- The string expressions si 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.
- If the spi in the replacements si->spi do not evaluate to strings, StringReplaceList will yield a StringExpression rather than an ordinary string.
- In replacements of the form si:>spi, the spi are not evaluated until each time they are used.
- Setting the option IgnoreCase->True makes StringReplaceList treat lowercase and uppercase letters as equivalent.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Scope (9)Survey of the scope of standard use cases

https://wolfram.com/xid/0dqtkayo286-ird4se


https://wolfram.com/xid/0dqtkayo286-vq6uak

Use pattern matching for dates:

https://wolfram.com/xid/0dqtkayo286-eg3o9g

Mixed regular expressions and string patterns:

https://wolfram.com/xid/0dqtkayo286-w8gzod

Use RuleDelayed (:>) in order to evaluate the right-hand side of a rule:

https://wolfram.com/xid/0dqtkayo286-clnwcm

Generate at most two possible results:

https://wolfram.com/xid/0dqtkayo286-0cnztn

Replace occurrences of either string:

https://wolfram.com/xid/0dqtkayo286-bhpvcm

StringReplaceList works on special characters:

https://wolfram.com/xid/0dqtkayo286-3c7un

StringReplaceList automatically threads over lists of strings:

https://wolfram.com/xid/0dqtkayo286-hz99ah

Options (1)Common values & functionality for each option
Applications (2)Sample problems that can be solved with this function
Five steps in the evolution of the Fibonacci multiway system [more info]:

https://wolfram.com/xid/0dqtkayo286-mdq

Two steps in the evolution of another multiway system:

https://wolfram.com/xid/0dqtkayo286-uao

All possible replacements of the form :

https://wolfram.com/xid/0dqtkayo286-kco

Possible Issues (1)Common pitfalls and unexpected behavior
StringReplaceList yields a StringExpression if the rule does not have a string result:

https://wolfram.com/xid/0dqtkayo286-civj3z


https://wolfram.com/xid/0dqtkayo286-rjg7w8

Wolfram Research (2004), StringReplaceList, Wolfram Language function, https://reference.wolfram.com/language/ref/StringReplaceList.html.
Text
Wolfram Research (2004), StringReplaceList, Wolfram Language function, https://reference.wolfram.com/language/ref/StringReplaceList.html.
Wolfram Research (2004), StringReplaceList, Wolfram Language function, https://reference.wolfram.com/language/ref/StringReplaceList.html.
CMS
Wolfram Language. 2004. "StringReplaceList." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/StringReplaceList.html.
Wolfram Language. 2004. "StringReplaceList." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/StringReplaceList.html.
APA
Wolfram Language. (2004). StringReplaceList. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StringReplaceList.html
Wolfram Language. (2004). StringReplaceList. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StringReplaceList.html
BibTeX
@misc{reference.wolfram_2025_stringreplacelist, author="Wolfram Research", title="{StringReplaceList}", year="2004", howpublished="\url{https://reference.wolfram.com/language/ref/StringReplaceList.html}", note=[Accessed: 19-June-2025
]}
BibLaTeX
@online{reference.wolfram_2025_stringreplacelist, organization={Wolfram Research}, title={StringReplaceList}, year={2004}, url={https://reference.wolfram.com/language/ref/StringReplaceList.html}, note=[Accessed: 19-June-2025
]}