for(String paramName:paramNames){
String regexString = regexPair.get(paramName);
try{
System.out.println(regexString);
Pattern p = Pattern.compile(regexString);
Matcher m = p.matcher(paramMap.get(paramName)[0]);
status = m.matches();
}catch(Exception e)
{
e.printStackTrace();
}
if(!status)
break;
}
where regexSring have value
"^(?!.*[^A-Za-z0-9@])((?=.*\\d)(?=.*[a-z]).{6,20})$"
The value of regexString is fecthed from mysql db an populated in map and paramMap.get(paramName)[0] have value "dssf55454" but it is retuning false while it should return true.
If I write the following sample program
Pattern p = Pattern.compile("^(?!.*[^A-Za-z0-9@])((?=.*\\d)(?=.*[a-z]).{6,20})$");
Matcher m = p.matcher("mal4554SD");
status = m.matches();
System.out.println(status);
it returns true. Why?