SonarQube is complaing my regex could cause overflow the stack , how can I fix it?
// Check each '+' is followed by an option
if (!consistOf.matches("^(\\+[A-Z0-9]+)+$"))
So on the Java side, I am trying to check if there is upper case letter and number string after the + sign:
for example: +AB1+CD2 will be a valid string, +ABC+ will not be valid
However, the sonarQube is saying that the regex I am using could cause stack over flow and here's the link that describes about this error.
I have trouble understanding what it is saying, but I kind of get that it is saying that it could have too much recursion going on.
Does anyone knows how can I fix this issue?