I performed code analyzer in IntelliJ IDEA and it shows weak warning as
Repetition range replaceable by '*'
Its shows warning on below line of code Where I'm using regex pattern
String pattern = prefix + ".{" + length + "}" + suffix;
I'm not sure whether my code will work after replace .{ with *
Simplified version of code :
String code = "AUTONARNDATEST";
String prefix = "AUTO";
String suffix = "TEST";
String length = "6";
String pattern = prefix + ".{" + length + "}" + suffix;
if(code.matches(pattern)) {
System.out.println("thumbs_up");
}else {
System.out.println("thumbs_down");
}
Can anyone please help.