A way of thinking about this that I've used in the past is that you want the expression to consist solely of the division of two things that don't have any divisions in them.
A pattern matching "something that doesn't have any divisions in it" is
`! m_anywhere( ?/? )
("look for a division anywhere in the expression. If you find one, this pattern doesn't match")
Then you want the division of two things like that:
`! m_anywhere( ?/? ) / `! m_anywhere( ?/? )
But a problem you encounter is that by default, the pattern-matcher treats division as multiplication by the reciprocal. You need to turn on
"strict inverse" mode to avoid that:
m_strictinverse(
`! m_anywhere(?/?)
/
`! m_anywhere(?/?)`?
)
I've chucked a `? on the end of the denominator, so it's optional - the student might think that the fraction cancels.