#26: fix to_gpt regex to strip space before punctuation#36
Open
VasilevNStas wants to merge 2 commits into
Open
#26: fix to_gpt regex to strip space before punctuation#36VasilevNStas wants to merge 2 commits into
VasilevNStas wants to merge 2 commits into
Conversation
Contributor
Author
kreinba
approved these changes
Jun 5, 2026
kreinba
left a comment
Contributor
There was a problem hiding this comment.
Character class [?!,:] replaces the alternation that contained an erroneous escaped pipe before the comma, so a space before any of the four punctuation marks is now stripped. Regression test exercises all four marks, jest and eslint pass locally. Resolves #26. 0 inline comments.
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
The regex alternation
(\\?|!|\\|,|:)into_gpt()uses\\|,which matches the two-character sequence|,, not a bare comma. Space before a comma is never removed.Solution:
Replace alternation with character class
([?!,:]). This correctly strips a space before any of?,!,,,:. Added regression testremoves spaces before punctuation.Checklist:
npx eslint .— 0 errorsnpx jest --coverage— all pass, coverage >=90%npx tsc --target es2020 --module nodenext --outDir dist— 0 errorsmake— lint + test + it + tsc pass