From cfd887d4fe4d08cb48274e20231bb0623de8087d Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Fri, 6 May 2016 22:13:19 -0400 Subject: [PATCH] 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 --- src/lib.rs | 2 +- src/re_unicode.rs | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 458f2d91ca..6daa122495 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -464,7 +464,7 @@ pub use re_unicode::{ Regex, Captures, SubCaptures, SubCapturesPos, SubCapturesNamed, CaptureNames, FindCaptures, FindMatches, Replacer, NoExpand, RegexSplits, RegexSplitsN, - quote, is_match, + quote, }; /** diff --git a/src/re_unicode.rs b/src/re_unicode.rs index 036893c755..943ff733dc 100644 --- a/src/re_unicode.rs +++ b/src/re_unicode.rs @@ -33,17 +33,6 @@ pub fn quote(text: &str) -> String { syntax::quote(text) } -/// Tests if the given regular expression matches somewhere in the text given. -/// -/// If there was a problem compiling the regular expression, an error is -/// returned. -/// -/// To find submatches, split or replace text, you'll need to compile an -/// expression first. -pub fn is_match(regex: &str, text: &str) -> Result { - Regex::new(regex).map(|r| r.is_match(text)) -} - /// A compiled regular expression for matching Unicode strings. /// /// It is represented as either a sequence of bytecode instructions (dynamic)