Skip to content

Avoid catastrophic bactracking in t-017 - #1004

Merged
acabal merged 1 commit into
standardebooks:masterfrom
apasel422:backtrack
Aug 11, 2026
Merged

Avoid catastrophic bactracking in t-017#1004
acabal merged 1 commit into
standardebooks:masterfrom
apasel422:backtrack

Conversation

@apasel422

@apasel422 apasel422 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

By making the (\w+\s*)+ sub-pattern possessive: There is no reason for the regex engine to backtrack in this pattern if it fails to match, as neither \w nor \s contains any of the subsequent punctuation that this lint is concerned with.

Add a basic test for this lint to prevent regressions here: Without the associated fix, the test never terminates.

Fixes #1003

By making the (\w+\s*)+ sub-pattern possessive: There is no reason for
the regex engine to backtrack in this pattern if it fails to match, as
neither \w nor \s contains any of the punctuation that this lint is
concerned with.

Add a basic test for this lint to prevent regressions here.

Fixes standardebooks#1003
@apasel422
apasel422 marked this pull request as ready for review August 10, 2026 23:29
@acabal
acabal merged commit 7fe2557 into standardebooks:master Aug 11, 2026
1 check passed
@acabal

acabal commented Aug 11, 2026

Copy link
Copy Markdown
Member

Great work, thanks!

@apasel422
apasel422 deleted the backtrack branch August 11, 2026 01:01
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.

se lint t-017 performance with long words

2 participants