We have calculated the binding energy and 'length' of a quasi one-dimensional exciton in a semiconductor quantum wire subjected to a magnetic field. The magnetic field causes these quantities to have non-monotonic dependences on wire width. Below a critical width, the binding energy decreases with increasing wire width as usual, but above this critical width the opposite behavior is observed. This gives rise to a pronounced minimum in the binding energy. A similar behavior gives rise to a pronounced maximum in the exciton length. These features are explained by invoking the complementary roles of the electrostatic and magnetostatic confinement of the exciton. (C) 1996 Academic Press Limited