Except
Details
- Except[c] is equivalent to Except[c,_].
- Except[c] represents the complement of the set of expressions that match c.
- Except works in StringExpression.
Examples
open all close allBasic Examples (2)
Scope (2)
Except works with patterns and string patterns:
Cases[{a, b, 0, 1, 2, x, y}, Except[_Integer]]StringReplace["1a2b3c4", Except[DigitCharacter].. -> ""]Cases[{a, b, 0, 1, 2, x, y}, Except[0, _Integer]]StringReplace["1a2b3c4", Except["a", LetterCharacter].. -> ""]Applications (3)
Cases[{1, 1, -5, EulerGamma, r, I, 0, Pi, 1 / 2}, Except[_Integer]]Find words containing nonword characters:
StringMatchQ[{"ain't", "test", "A&M", "anybody"}, ___ ~~ Except[WordCharacter] ~~ ___]Strip off all tags "<...>" from an HTML document:
StringReplace[
"<title>The Title</title>
<h1>The <a href='link'>head</a></h1>
<p>Some text follows here...</p>", "<" ~~ Except[">"].. ~~ ">" -> ""]See Also
Related Guides
Related Workflows
- Write a Function That Can Return Unevaluated
History
Introduced in 2004 (5.1)
Text
Wolfram Research (2004), Except, Wolfram Language function, https://reference.wolfram.com/language/ref/Except.html.
CMS
Wolfram Language. 2004. "Except." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Except.html.
APA
Wolfram Language. (2004). Except. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Except.html
BibTeX
@misc{reference.wolfram_2026_except, author="Wolfram Research", title="{Except}", year="2004", howpublished="\url{https://reference.wolfram.com/language/ref/Except.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_except, organization={Wolfram Research}, title={Except}, year={2004}, url={https://reference.wolfram.com/language/ref/Except.html}, note=[Accessed: 12-June-2026]}