I have an expression of the form
expr = 3*(a.b)*(c.d)*f[x] + 5*(m.n)*(p.q)*(r.s)*f[y]
and want to extract all possible subexpressions matching the pattern ((_).(_))*f[_]
.
Expected result (in arbitrary order) is:
{(a.b)*f[x], (c.d)*f[x], (m.n)*f[y], (p.q)*f[y], (r.s)*f[y]}
Built-in function Cases
seem to ignore Flat
Attribute of Times
and gives nothing:
Cases[expr, ((_).(_))*f[_], Infinity]
{}
How can I get all possible subexpressions matching the pattern ((_).(_))*f[_]
?