Skip to content

Commit 7392c4e

Browse files
committed
Remove free is_match function.
It encourages compiling a regex for every use, which can be convenient in some circumstances but deadly for performance. Fixes #165
1 parent 5bad47d commit 7392c4e

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ pub use re_unicode::{
462462
Regex, Captures, SubCaptures, SubCapturesPos, SubCapturesNamed,
463463
CaptureNames, FindCaptures, FindMatches,
464464
Replacer, NoExpand, RegexSplits, RegexSplitsN,
465-
quote, is_match,
465+
quote,
466466
};
467467

468468
/**

src/re_unicode.rs

-11
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,6 @@ pub fn quote(text: &str) -> String {
3333
syntax::quote(text)
3434
}
3535

36-
/// Tests if the given regular expression matches somewhere in the text given.
37-
///
38-
/// If there was a problem compiling the regular expression, an error is
39-
/// returned.
40-
///
41-
/// To find submatches, split or replace text, you'll need to compile an
42-
/// expression first.
43-
pub fn is_match(regex: &str, text: &str) -> Result<bool, Error> {
44-
Regex::new(regex).map(|r| r.is_match(text))
45-
}
46-
4736
/// A compiled regular expression for matching Unicode strings.
4837
///
4938
/// It is represented as either a sequence of bytecode instructions (dynamic)

0 commit comments

Comments
 (0)