StringDelete
✖
StringDelete
yields the string obtained by deleting from string all occurrences of anything matching the string pattern patt.
represents an operator form of StringDelete that can be applied to an expression.
Details and Options

- The string expression patt can contain any of the objects specified in the notes for StringExpression.
- Setting the option IgnoreCase->True makes StringDelete treat lowercase and uppercase letters as equivalent.
- StringDelete[patt][expr] is equivalent to StringDelete[expr,patt].
- StringDelete[BioSequence["type","seq"],patt] removes cases of patt in the string "seq" yielding a biomolecular sequence. In this case, degenerate letters in patt are interpreted as wildcard patterns based on the type of biomolecular sequence. Use Verbatim["patt"] to match degenerate letters literally.
- The documentation for BioSequence lists the degenerate letters supported by each type of biomolecular sequence.
- If the biomolecular sequence operated upon by StringDelete is circular, wraparound matches are possible.
Examples
open allclose allBasic Examples (4)Summary of the most common use cases
Remove whitespace from a string:

https://wolfram.com/xid/0cg3cyuwi-czr4s4

Remove a specific character sequence:

https://wolfram.com/xid/0cg3cyuwi-ert3tl

Delete substrings matching a string pattern:

https://wolfram.com/xid/0cg3cyuwi-x5ekd9

Use the operator form of StringDelete:

https://wolfram.com/xid/0cg3cyuwi-il6614

Scope (4)Survey of the scope of standard use cases
Remove corresponding substrings from a biomolecular sequence:

https://wolfram.com/xid/0cg3cyuwi-7xc191

Delete codon-length subsequences in a DNA sequence:

https://wolfram.com/xid/0cg3cyuwi-2kv8or

StringDelete respects the degenerate letters and circularity of the provided BioSequence:

https://wolfram.com/xid/0cg3cyuwi-k6qccb


https://wolfram.com/xid/0cg3cyuwi-vlh06z


https://wolfram.com/xid/0cg3cyuwi-7rp9en

Use Verbatim to restrict degenerate letter matching to exact matches:

https://wolfram.com/xid/0cg3cyuwi-x7q8qh

Wolfram Research (2015), StringDelete, Wolfram Language function, https://reference.wolfram.com/language/ref/StringDelete.html (updated 2020).
Text
Wolfram Research (2015), StringDelete, Wolfram Language function, https://reference.wolfram.com/language/ref/StringDelete.html (updated 2020).
Wolfram Research (2015), StringDelete, Wolfram Language function, https://reference.wolfram.com/language/ref/StringDelete.html (updated 2020).
CMS
Wolfram Language. 2015. "StringDelete." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/StringDelete.html.
Wolfram Language. 2015. "StringDelete." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/StringDelete.html.
APA
Wolfram Language. (2015). StringDelete. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StringDelete.html
Wolfram Language. (2015). StringDelete. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StringDelete.html
BibTeX
@misc{reference.wolfram_2025_stringdelete, author="Wolfram Research", title="{StringDelete}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/StringDelete.html}", note=[Accessed: 12-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_stringdelete, organization={Wolfram Research}, title={StringDelete}, year={2020}, url={https://reference.wolfram.com/language/ref/StringDelete.html}, note=[Accessed: 12-April-2025
]}