I have this function
function validateUsername(str,minL,maxL){// i'm passing validateUsername("asdf_1",2,8)
var exp=new RegExp(/^[a-z0-9_-]\w{"+minL+","+maxL+"}$/);
switch(exp.test(str)){
case true: return true;
case false: return false;
}
}
I want to insert minimum Length and maximum length dynamically, But if above code used,its giving me false whether it should accept the string as true.
can anyone tell me, what should i use rather "+variable+" to insert the value dynamically.
Thanks in advance.