|
SOLUTIONS
|
BUILT-IN MATHEMATICA SYMBOL
StringCases
StringCases["string", patt]
gives a list of the substrings in
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
.
StringCases[{s1, s2, ...}, p]
gives the list of results for each of the
.
Details and OptionsDetails and Options
- String expressions can contain any of the objects specified in the notes for StringExpression.
- With the default option setting Overlaps->False, StringCases includes only substrings that do not overlap. With Overlaps->True it includes substrings that overlap.
- 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.
- Setting the option IgnoreCase->True makes StringCases treat lowercase and uppercase letters as equivalent.
- StringCases["string", RegularExpression["regex"]] gives substrings matching the specified regular expression.
- StringCases[s, lhs:>rhs] evaluates rhs only when the pattern is found.
New in 5.1
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
