Skip to content

docs: clarify half-boundary syntax for the -w/--word-regexp flag#3279

Merged
BurntSushi merged 1 commit intoBurntSushi:masterfrom
waldyrious:document-word-regexp-update
Feb 27, 2026
Merged

docs: clarify half-boundary syntax for the -w/--word-regexp flag#3279
BurntSushi merged 1 commit intoBurntSushi:masterfrom
waldyrious:document-word-regexp-update

Conversation

@waldyrious
Copy link
Copy Markdown
Contributor

In regex 1.10.0, the \b{start-half} and \b{end-half} assertions were introduced to improve how the -w/--word-regexp flag handles patterns containing non-word characters. While ripgrep's CLI help text was updated to mention this syntax during the lexopt transition (082245d), it omitted the rationale, potentially leaving users puzzled by this casual mention of a highly specific, non-standard regex feature.

Furthermore, GUIDE.md was still outdated, incorrectly claiming that -w wraps patterns in standard \b boundaries, further compounding the inconsistency and potential for confusion.

This patch updates GUIDE.md to reflect the actual underlying regex employed by ripgrep when the -w/--word-regexp flag is used.
It also adds a brief explanation to both the guide and the manpage acknowledging the non-standard nature of these half-boundary markers, and explaining what they're meant for.

In regex 1.10.0, the \b{start-half} and \b{end-half} assertions were
introduced to improve how the -w/--word-regexp flag handles patterns
containing non-word characters. While ripgrep's CLI help text was
updated to mention this syntax during the lexopt transition (082245d),
it omitted the rationale, potentially leaving users puzzled by this
casual mention of a highly specific, non-standard regex feature.

Furthermore, GUIDE.md was still outdated, incorrectly claiming
that -w wraps patterns in standard \b boundaries,
further compounding the inconsistency and potential for confusion.

This commit updates GUIDE.md to reflect the actual underlying regex
employed by ripgrep when the -w/--word-regexp flag is used.
It also adds a brief explanation to both the guide and the manpage
acknowledging the non-standard nature of these half-boundary markers,
and explaining what they're meant for.
@BurntSushi BurntSushi force-pushed the document-word-regexp-update branch from 03b9c33 to 3fc9f41 Compare February 27, 2026 16:10
Copy link
Copy Markdown
Owner

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The GUIDE has been wrong for quite some time I think. ripgrep hasn't implemented -w/--word-regexp using \b since 2018.

@BurntSushi
Copy link
Copy Markdown
Owner

I've pushed some tweaks to the wording here.

@BurntSushi BurntSushi merged commit 4519153 into BurntSushi:master Feb 27, 2026
21 checks passed
@waldyrious
Copy link
Copy Markdown
Contributor Author

Thanks for the wording tweaks — your text is indeed clearer and more accurate :)

I appreciate the quick review and merge!

@waldyrious waldyrious deleted the document-word-regexp-update branch February 27, 2026 17:46
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.

2 participants