I'm assuming your comments suggests combining lines 40 and 44 into one line. Would you then define quantity_match on a separate line?

The reason I did it this way is because you can't call .match on nil and we need to define quantity_match somewhere...