What does "doesn't work" mean? "Doesn't work" is an inadequate description for us to understand the problem. What happened when you tried it? Did you get incorrect results? Did you get no results? If the results were incorrect, what made them incorrect? What were you expecting instead? Did you get any correct results? If so, what were they? Don't make us guess.
var exp = /((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,20})/