0

Seeking assistance in optimizing a regex pattern to satisfy Sonar:

enter image description here

Is there a way to reduce/refactor this?

Sample:

/api/v1
/api/v1/
/api/v1//
/api/v1///
/api/v23
/api/3
/api/2
/adad/adad/1
/api/2/asd/2
/a
/

Expected match:

/api/v1
/api/v1/
/api/v23
/api/3
/adad/adad/1
/api/2/asd/2
/a
/
L P
  • 1,776
  • 5
  • 25
  • 46

0 Answers0