StringCases¶
Finds all occurrences of a substring.
A list of strings is handled string by string, so the matches of each stay together:
A subject that is not a string is refused rather than coerced to its printed form:
$ wo 'StringCases[foo, "a"]'
StringCases::strse: A string or list of strings is expected at position 1 in StringCases[foo, a].
StringCases[foo, a]
The Overlaps option controls how much of the string a match may share with
its neighbours. The default keeps matches disjoint, Overlaps -> True reports
the preferred match at every start position, and Overlaps -> All reports
every match at every start position:
A greedy pattern reports its longest match first at each start position, so
Shortest flips the order within each group:
A DatePattern matches the date fields it names, each read whole:
A field out of range matches nothing: