Containing["outer","inner"]
represents an object of type outer containing objects of type inner.
Containing
Containing["outer","inner"]
represents an object of type outer containing objects of type inner.
Details
- Containing is used in constructs such as TextCases and TextPosition.
Examples
open all close allBasic Examples (1)
Find all sentences in a string that contain currency amounts:
TextCases["I went to the store. I spent $50.", Containing["Sentence", "CurrencyAmount"]]Find all sentences in a string that contain countries:
TextCases["I went to France. Then I went home.", Containing["Sentence", "Country"]]Find sentences containing proper nouns:
TextCases["John went to the store. Then he went home.", Containing["Sentence", "ProperNoun"]]Scope (1)
Combine Alternatives and Containing to form highly structured queries:
TextCases["The fox chased the mouse. The mouse ran away quickly. The mouse lived in a small hole in the ground.", Containing["Sentence", "Adjective" | "Adverb"]]TextCases["I have a fairly clear idea of what I will buy at the store. I want shoes, a computer, and a jacket. The computer will be the most expensive, and will cost over $1000. John will like my computer.", Containing["Sentence", "CurrencyAmount" | "ProperNoun"]]Applications (1)
Find sentences in the Declaration of Independence that contain countries:
decl = ExampleData[{"Text", "DeclarationOfIndependence"}];countries = TextCases[decl, Containing["Sentence", "Country"]];Display the matches in a readable form:
Column[Framed /@ countries]See Also
Related Guides
History
Text
Wolfram Research (2015), Containing, Wolfram Language function, https://reference.wolfram.com/language/ref/Containing.html.
CMS
Wolfram Language. 2015. "Containing." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Containing.html.
APA
Wolfram Language. (2015). Containing. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Containing.html
BibTeX
@misc{reference.wolfram_2026_containing, author="Wolfram Research", title="{Containing}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/Containing.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_containing, organization={Wolfram Research}, title={Containing}, year={2015}, url={https://reference.wolfram.com/language/ref/Containing.html}, note=[Accessed: 12-June-2026]}