Skip to content

Commit

Permalink
Remove free is_match function.
Browse files Browse the repository at this point in the history
It encourages compiling a regex for every use, which can be convenient
in some circumstances but deadly for performance.

Fixes #165
  • Loading branch information
BurntSushi committed May 7, 2016
1 parent 5bad47d commit 7392c4e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ pub use re_unicode::{
Regex, Captures, SubCaptures, SubCapturesPos, SubCapturesNamed,
CaptureNames, FindCaptures, FindMatches,
Replacer, NoExpand, RegexSplits, RegexSplitsN,
quote, is_match,
quote,
};

/**
Expand Down
11 changes: 0 additions & 11 deletions src/re_unicode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool, Error> {
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)
Expand Down

0 comments on commit 7392c4e

Please sign in to comment.