^ (? =. * [A-Za-z]) (? =. * \ D) [A-Za-z \ d] {6,18} $
Forward first assertion
(? =. * [A-Za-z])
(?=.*\d)
[A-Za-z \ d] {6,18}
This is split into three parts, the first two parts limitation, letters + numbers, must be present; the third part, the limited number of 6 to 18