Skip to content

Commit a0498db

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 16bb79a commit a0498db

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ pub use re_unicode::{
464464
Regex, Captures, SubCaptures, SubCapturesPos, SubCapturesNamed,
465465
CaptureNames, FindCaptures, FindMatches,
466466
Replacer, NoExpand, RegexSplits, RegexSplitsN,
467-
quote, is_match,
467+
quote,
468468
};
469469

470470
/**

src/re_unicode.rs

Lines changed: 0 additions & 11 deletions
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)