# Matching combinations of StringExpressions and general patterns i

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.

You can use Condition and StringMatchQ:
{

• Is there a way to define a smarter version of Cases that applies StringMatchQ to StringExpression wherever these appear input expression? Sep 3, 2018 at 23:25