fix script regex

it was giving some links with errors in the subsection like these:

https://fmhy.pages.dev/storage/#drive-formatting--file_deletion
https://fmhy.pages.dev/storage/#ip--dns_leak_tests

and a bunch more, not replacing every underscore
This commit is contained in:
Rust1667 2023-04-07 13:44:03 +02:00 committed by GitHub
parent 472aeffa04
commit 5589e0effb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,7 +74,7 @@ def replace_domain_and_page(text):
return text
def replace_underscore_in_subsections(text):
pattern = r'(/#[\w]+(?:_[\w]+)*)'
pattern = r'(/#[\w\-]+(?:_[\w]+)*)'
matches = re.findall(pattern, text)
for match in matches:
replacement = match.replace('_', '-')