Repository: vacanza/python-holidays

Issue:
[SonarCloud] Suppress warning `Python:S5852` or replace the affected RegEx strings with non-* equivalent
From [SonarCloud check](https://sonarcloud.io/project/security_hotspots?id=vacanza_python-holidays&branch=beta&resolved=false&inNewCodePeriod=true), for `dev` branch

> Make sure the regex used here, which is vulnerable to polynomial runtime due to backtracking, cannot lead to denial of service.

> Using slow regular expressions is security-sensitive[python:S5852](https://sonarcloud.io/organizations/vacanza/rules?open=python%3AS5852&rule_key=python%3AS5852)

All 3 affected instances are:
-  `pr = re.findall(r"^(.*) \(#\d+ .*\)$", pr)[0]` in [scripts/generate_release_notes.py](https://github.com/vacanza/python-holidays/blob/beta/scripts/generate_release_notes.py)
- `subdivision_group_re = re.compile(".*: (.*)")` and `subdivision_aliases_re = re.compile(r"(.*)\s\((.*?)\)")` in [test/test_docs.py](https://github.com/vacanza/python-holidays/blob/beta/tests/test_docs.py)


Discussion:

Resolving patch:
diff --git a/scripts/generate_release_notes.py b/scripts/generate_release_notes.py
--- a/scripts/generate_release_notes.py
+++ b/scripts/generate_release_notes.py
@@ -114,22 +114,20 @@ def is_ready(self):
     @property
     def sorted_pull_requests(self):
         def custom_order(pr):
-            pr = re.findall(r"^(.*) \(#\d+ .*\)$", pr)[0]
-
-            if re.findall(r"^(Introduce|Refactor)", pr) or re.findall(r"Add .* support", pr):
+            if re.findall(r"^(Introduce|Refactor)", pr[0]) or re.findall(r"Add .* support", pr[0]):
                 weight = 10
-            elif re.findall(r"^Add .* holidays$", pr):
+            elif re.findall(r"^Add .* holidays$", pr[0]):
                 weight = 20
-            elif re.findall(r"(^Localize|localization$)", pr):
+            elif re.findall(r"(^Localize)|(localization$)", pr[0]):
                 weight = 30
-            elif re.findall(r"^Fix", pr):
+            elif re.findall(r"^Fix", pr[0]):
                 weight = 40
-            elif re.findall(r"^(Change|Improve|Optimize|Update|Upgrade)", pr):
+            elif re.findall(r"^(Change|Improve|Optimize|Update|Upgrade)", pr[0]):
                 weight = 50
             else:
                 weight = 100
 
-            return (weight, pr)
+            return weight, pr
 
         return sorted(self.pull_requests.values(), key=custom_order)
 
@@ -158,7 +156,8 @@ def add_pull_request(self, pull_request):
             contributors.remove(author)
         contributors = (f"@{c}" for c in [author] + sorted(contributors, key=str.lower))
         self.pull_requests[pull_request.number] = (
-            f"{pull_request.title} (#{pull_request.number} by " f"{', '.join(contributors)})"
+            pull_request.title,
+            f"#{pull_request.number} by {', '.join(contributors)}",
         )
 
     def generate_release_notes(self):
@@ -246,7 +245,7 @@ def print_release_notes(self):
                     year=today.year,
                 )
             )
-            print("\n".join((f"- {pr}" for pr in self.sorted_pull_requests)))
+            print("\n".join((f"- {pr[0]} ({pr[1]})" for pr in self.sorted_pull_requests)))
 
         else:
             print(f"No changes since {self.latest_tag_name} release.")


Test patch:
diff --git a/tests/test_docs.py b/tests/test_docs.py
--- a/tests/test_docs.py
+++ b/tests/test_docs.py
@@ -47,9 +47,9 @@ def test_supported_countries_table(self):
         country_subdivisions_aliases = {}
         country_supported_languages = {}
         country_supported_categories = {}
-        subdivision_group_re = re.compile(".*: (.*)")
+        subdivision_group_re = re.compile("\w+: ([\s\w,*()]+)")
         subdivision_and_aliases_re = re.compile(r",(?![^()]*\))")
-        subdivision_aliases_re = re.compile(r"(.*)\s\((.*?)\)")
+        subdivision_aliases_re = re.compile(r"(.*?)\s\((.*?)\)")
 
         table_content = [
             line.strip()