Wolfram Language & System 10.3 (2015)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)


gives a list of all cases of form that occur in text.

gives the first n cases that occur.

Details and OptionsDetails and Options

  • By default, TextCases["text",form] returns all substrings of text that match the specified form.
  • In TextCases["text",form->spec], spec defines what should be returned for each match.
  • Possible choices for spec are:
  • "String"the substring of text matched (default)
    "Position"the start and end position of the substring matched
    "Type"the type of object matched (e.g. "Word" or "Country")
    "Interpretation"the standard interpretation of the object matched
    {spec1,spec2,}a list of several specifications
  • Structural choices for form include:
  • "Word"word-like unit (usually delimited by whitespace)
    "Sentence"sentence-like unit (usually delimited by .)
    "Paragraph"paragraph-like unit (delimited by multiple newlines etc.)
    "Quotation"quotation delimited by quotation marks
    "Line"substring delimited by newline
    "Punctuation"punctuation mark (e.g. "?", "!!!", etc.)
    "NonText"characters not in ordinary letter-like text
  • Grammatical choices for form include:
  • "Noun","Verb",specified part of speech
    "ProperNoun"proper noun
    "Emoticon"textual emoticon
  • Formatting-based choices for form include:
  • "URL"correctly formatted URL
    "EmailAddress"correctly formatted email address
    "TwitterHandle"correctly formatted Twitter handle
    "PhoneNumber"international phone numbers
  • Semantic choices for form include:
  • "Number"number in standard format
    "Quantity"quantity with units
    "CurrencyAmount"currency with denomination
    "Country"country or country designation
    "Color"color specification or name
    "English","Chinese",sentences written in the specified language
    "Profanity"paragraphs that contain profanity
    "PositiveSentiment",paragraphs with positive, negative, or neutral sentiment
    Entity["type",name]strings corresponding to a particular entity
  • Combination choices for form include:
  • form1|form2|form matching any of the
    Containing[outer,inner]forms of type outer containing ones of type inner
  • The following options for TextCases can be given:
  • PerformanceGoalAutomaticwhat aspects of performance to optimize
  • Possible settings for PerformanceGoal include and .
Introduced in 2015