summaryrefslogtreecommitdiffstats
path: root/grep-regex/src/matcher.rs
diff options
context:
space:
mode:
Diffstat (limited to 'grep-regex/src/matcher.rs')
-rw-r--r--grep-regex/src/matcher.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/grep-regex/src/matcher.rs b/grep-regex/src/matcher.rs
index b15d824c..391439d9 100644
--- a/grep-regex/src/matcher.rs
+++ b/grep-regex/src/matcher.rs
@@ -50,9 +50,12 @@ impl RegexMatcherBuilder {
if let Some(ref re) = fast_line_regex {
trace!("extracted fast line regex: {:?}", re);
}
+
+ let matcher = RegexMatcherImpl::new(&chir)?;
+ trace!("final regex: {:?}", matcher.regex());
Ok(RegexMatcher {
config: self.config.clone(),
- matcher: RegexMatcherImpl::new(&chir)?,
+ matcher: matcher,
fast_line_regex: fast_line_regex,
non_matching_bytes: non_matching_bytes,
})
@@ -370,6 +373,15 @@ impl RegexMatcherImpl {
Ok(RegexMatcherImpl::Standard(StandardMatcher::new(expr)?))
}
}
+
+ /// Return the underlying regex object used.
+ fn regex(&self) -> &Regex {
+ match *self {
+ RegexMatcherImpl::Word(ref x) => x.regex(),
+ RegexMatcherImpl::CRLF(ref x) => x.regex(),
+ RegexMatcherImpl::Standard(ref x) => &x.regex,
+ }
+ }
}
// This implementation just dispatches on the internal matcher impl except