This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)


StringCases["string", patt]
gives a list of the substrings in "string" that match the string expression patt.
StringCases["string", lhs->rhs]
gives a list of the values of rhs corresponding to the substrings that match the string expression lhs.
StringCases["string", p, n]
includes only the first n substrings that match.
StringCases["string", {p1, p2, ...}]
gives substrings that match any of the pi.
StringCases[{s1, s2, ...}, p]
gives the list of results for each of the si.
  • String expressions can contain any of the objects specified in the notes for StringExpression.
  • With Overlaps->All, multiple substrings that match the same string expression are all included. With Overlaps->True, only the first such matching substring at a given position is included.
  • StringCases[s, lhs:>rhs] evaluates rhs only when the pattern is found.
New in 5.1