Skip to content

Commit db6f43c

Browse files
CopilotMishkatIT
andcommitted
Improve regex patterns based on code review feedback
Co-authored-by: MishkatIT <125080003+MishkatIT@users.noreply.github.com>
1 parent 3426e31 commit db6f43c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

update_readme.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ def update_readme(stats, last_known_info=None, update_source=None):
281281
readme_content = re.sub(progress_pattern, progress_replacement, readme_content, flags=re.DOTALL)
282282

283283
# Update the "Updated On" column for each platform
284-
# Pattern matches: platform name -> any content -> progress badge -> updated on cell
284+
# Pattern matches: platform name -> progress badge with specific percentage -> updated on cell
285+
# Using the specific percentage makes the pattern more precise and ensures we update the correct row
285286
updated_on_pattern = rf'({platform_name}.*?Progress-{percentage}%25.*?<td align="center">).*?</td>'
286287
updated_on_replacement = rf'\g<1>{date_str}</td>'
287288
readme_content = re.sub(updated_on_pattern, updated_on_replacement, readme_content, flags=re.DOTALL)
@@ -294,8 +295,9 @@ def update_readme(stats, last_known_info=None, update_source=None):
294295
)
295296

296297
# Update the "Updated On" column in the footer (total row)
298+
# Pattern is flexible to handle potential rounding differences in percentage
297299
readme_content = re.sub(
298-
r'(TOTAL.*?<td align="center"><strong>100%</strong></td>\s*<td align="center">).*?</td>',
300+
r'(TOTAL.*?<td align="center"><strong>\d+(?:\.\d+)?%</strong></td>\s*<td align="center">).*?</td>',
299301
rf'\g<1>{current_date}</td>',
300302
readme_content,
301303
flags=re.DOTALL

0 commit comments

Comments
 (0)