mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-06-25 14:22:54 +02:00
fix word boundary w/ capture group
fixes BurntSushi/ripgrep#506. Word boundary search as arg had unexpected behavior. added capture group to regex to encapsulate 'or' option search and prevent expansion and partial boundary finds. Signed-off-by: Evan.Mattiza <emattiza@gmail.com>
This commit is contained in:
committed by
Andrew Gallant
parent
e0989ef13b
commit
06393f888c
@ -505,7 +505,7 @@ impl<'a> ArgMatches<'a> {
|
||||
/// flag is set. Otherwise, the pattern is returned unchanged.
|
||||
fn word_pattern(&self, pat: String) -> String {
|
||||
if self.is_present("word-regexp") {
|
||||
format!(r"\b{}\b", pat)
|
||||
format!(r"\b(?:{})\b", pat)
|
||||
} else {
|
||||
pat
|
||||
}
|
||||
|
Reference in New Issue
Block a user