This would allow something like "100 in cm px mm cm px px ..." and would not allow "100 x100" (only "100x100").
And I think it would not allow "100px x 100px", only "100px x100px".

So I think this should be something like ((\d+)(?:(in|cm|mm|px) )?|\?) *x *...