Is there a clean way to match patterns that combine general patterns and ?StringExpression
For example, Cases
will not match any parts in this construction:
{{"my Foo", 1}, {"my Bar", "a"}, {"your Foo", "b"}, {"your Bar", 4}} // Cases[{"my" ~~ __, _Integer}]
{}
Of course StringCases
can be used on the string expression parts but then
{{"my Foo", 1}, {"my Bar", "a"}, {"your Foo", "b"}, {"your Bar", 4}} //
Map[First] // StringCases["my" ~~ __]
{{"my Foo"}, {"my Bar"}, {}, {}}
This seems a very basic question, I'd be surprised if it hasn't been asked before but didn't find anything with a cursory search.