Wolfram Language & System 10.0 (2014)|Legacy Documentation

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


gives a count of the number of times appears as a substring of .

gives the number of substrings in that match the general string expression patt.

counts the number of occurrences of any of the .

gives the list of results for each of the .

Details and OptionsDetails and Options

  • The string expression patt can contain any of the objects specified in the notes for StringExpression.
  • With the default option setting Overlaps->False, overlapping substrings are not treated as separate. With the setting Overlaps->True, StringCount counts substrings that overlap as separate.
  • With Overlaps->All, multiple substrings that match the same string expression are all counted as separate. With Overlaps->True, only the first such matching substring at a given position is counted as separate.
  • Setting the option IgnoreCase->True makes StringCount treat lowercase and uppercase letters as equivalent.
  • StringCount["string",RegularExpression["regex"]] gives the number of substrings matching the specified regular expression.
Introduced in 2004