Match comma-separated unread counts in tab titles - #1
Open
doug-proctor wants to merge 1 commit into
Open
Conversation
Gmail formats unread counts above 999 with commas, e.g. "Inbox (1,234)". The old pattern \(\d+\) only matched digits, so those titles were left unchanged and the count stayed visible. The pattern is now \(\d[\d,]*\), which requires a leading digit and then allows digits and commas. Plain counts like (5) still match. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
What changed
One line in
content.js. The regex that strips the unread count from the tab title:The comment above it was updated to use
Inbox (1,234)as the example.Why
Gmail writes unread counts above 999 with a comma separator, for example
Inbox (1,234). The old pattern\(\d+\)only matched runs of digits, so it did not match those titles. The count stayed visible in the tab for anyone with more than 999 unread messages — which is a large share of the people this extension is for.The new pattern requires a leading digit, then allows digits and commas.
Test results
I ran the new regex against these titles:
Inbox (1,234)InboxGmail - Primary (5)Gmail - PrimaryInbox (1,234) - user@gmail.com - GmailInbox - user@gmail.com - GmailInbox (12,345,678)InboxPlain counts like
(5)still work, so this is not a regression.Note for the reviewer
The pattern accepts a trailing comma, so
Inbox (1,)becomesInbox. It rejects a leading comma and an empty pair, so(,234)and()are left alone. Gmail does not produce(1,), so this does not affect real titles. Tightening it to\(\d{1,3}(,\d{3})*\)would be stricter but would then miss any format that is not exactly three-digit groups. I left it loose on purpose.There are no automated tests in this repo, so the table above is manual verification with Node, not a test suite.
🤖 Generated with Claude Code