Skip to content

Conversation

dimikot
Copy link
Owner

@dimikot dimikot commented Jun 24, 2025

Summary

Fixing the regular expression pattern error in the Python script by adjusting the handling of escape sequences. This change resolves the issue where the script would throw a re.PatternError due to incorrect escape sequences like \s in regex patterns. The modification involves using a lambda function to ensure that the replacement string in re.sub calls is treated correctly, preventing the error from occurring.

Essential Code Lines

new_body = re.sub(BODY_SUFFIX_RE, lambda _: suffix, body, flags=re.M | re.I | re.X)

CleanShot 2025-06-23 at 21 18 40@2x

How was this tested?

python3 tests/test_ai.py

PRs in the Stack

(The stack is managed by git-grok.)

@dimikot dimikot force-pushed the grok/dimikot/fix-e-g-re-patternerror-bad-escape-s-at-position-error-to-main-8368 branch from 8368dbe to fa20bed Compare June 24, 2025 04:33
@dimikot dimikot merged commit 9275b36 into main Jun 24, 2025
2 of 4 checks passed
@dimikot dimikot deleted the grok/dimikot/fix-e-g-re-patternerror-bad-escape-s-at-position-error-to-main-8368 branch June 24, 2025 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant