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 Aug 5, 2016
1 parent 16bb79a commit a0498db
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 @@ -464,7 +464,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 a0498db

Please sign in to comment.