docs: clarify half-boundary syntax for the -w/--word-regexp flag#3279
Merged
BurntSushi merged 1 commit intoBurntSushi:masterfrom Feb 27, 2026
Merged
Conversation
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.
03b9c33 to
3fc9f41
Compare
BurntSushi
approved these changes
Feb 27, 2026
Owner
BurntSushi
left a comment
There was a problem hiding this comment.
Thanks! The GUIDE has been wrong for quite some time I think. ripgrep hasn't implemented -w/--word-regexp using \b since 2018.
Owner
|
I've pushed some tweaks to the wording here. |
Contributor
Author
|
Thanks for the wording tweaks — your text is indeed clearer and more accurate :) I appreciate the quick review and merge! |
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.
In regex 1.10.0, the
\b{start-half}and\b{end-half}assertions were introduced to improve how the-w/--word-regexpflag 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.mdwas still outdated, incorrectly claiming that-wwraps patterns in standard\bboundaries, further compounding the inconsistency and potential for confusion.This patch updates
GUIDE.mdto reflect the actual underlying regex employed by ripgrep when the-w/--word-regexpflag 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.