I have this very specific use case where I want to check if a String contains 2 lower case letters, concatenated by a variable number of digits and a "-abc".
The "-abc" part must not be variable and should always be "-abc". So in the end only the number of digits can be variable.
It can be like this :
ab123-abc
or like this :
ab123456-abc
or even like this :
cd5678901234-abc
I have tried the following but it does not work :
if (s.toLowerCase().matches("^([a-z]{2})(?=.*[0-9])-abc")) {
return true;
}