I'm getting a critical sonar issue "Using regular expressions is security-sensitive" when using the code
Pattern.compile(regex, Pattern.CASE_INSENSITIVE)
Can anyone help to fix this? Is there any alternatives available for this?
I'm getting a critical sonar issue "Using regular expressions is security-sensitive" when using the code
Pattern.compile(regex, Pattern.CASE_INSENSITIVE)
Can anyone help to fix this? Is there any alternatives available for this?
As per this Sonarsource documenation,
This rule flags any execution of a hardcoded regular expression which has at least 3 characters and at least two instances of any of the following characters:
*+{.
.
So, you must make sure your pattern complies with the rule.
Alternatively, you may disable the warnings by Turning Sonar off for certain code.