I have created regular expression for checking consecutive three repeated characters.It is working fine while testing on Online regex tester but same expression doesn't seem to work when I implemented it in code. What's wrong with my implementation?
Pattern pattern = Pattern.compile("([a-z\\d])\\1\\1");
Matcher matcher = pattern.matcher(s);
if(matcher.matches()){
return false;
}
else
return true;