0

I have two regex patterns that Sonarqube is complaining about. The error message I'm getting for both is:

Refactor this repetition that can lead to a stack overflow for large inputs

The first pattern I'm trying to match is an IPv6 hex address:

^((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)::((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)$

The second pattern is for an OS version (13, 13.0, 13.0.1):

[0-9]+(\.[0-9]+)*

I'm unsure how to go about resolving these and any help would be greatly appreciated.

selbay84
  • 45
  • 1
  • 2
  • 7

0 Answers0