diff options
author | Evan.Mattiza <emattiza@gmail.com> | 2017-06-14 22:07:55 -0500 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2017-06-15 06:55:55 -0400 |
commit | 06393f888c664d0fe2a31422a05b60f6d1bd0b6a (patch) | |
tree | c50a882f78ffe2f34486572414177996ab65304e /src | |
parent | e0989ef13bf6be0659fbb8bac3975522b155cbc1 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/args.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/args.rs b/src/args.rs index 068a40d5..b0e5d648 100644 --- a/src/args.rs +++ b/src/args.rs @@ -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 } |