From a0aa2307322cd47bbf416810ac0292925e03be87 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 19:39:49 +0200 Subject: Adding upstream version 1:7.0.3. Signed-off-by: Daniel Baumann --- .../vendor/regex/examples/shootout-regex-dna-replace.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 rust/vendor/regex/examples/shootout-regex-dna-replace.rs (limited to 'rust/vendor/regex/examples/shootout-regex-dna-replace.rs') diff --git a/rust/vendor/regex/examples/shootout-regex-dna-replace.rs b/rust/vendor/regex/examples/shootout-regex-dna-replace.rs new file mode 100644 index 0000000..20694e0 --- /dev/null +++ b/rust/vendor/regex/examples/shootout-regex-dna-replace.rs @@ -0,0 +1,17 @@ +use std::io::{self, Read}; + +macro_rules! regex { + ($re:expr) => {{ + use regex::internal::ExecBuilder; + ExecBuilder::new($re).build().unwrap().into_regex() + }}; +} + +fn main() { + let mut seq = String::with_capacity(50 * (1 << 20)); + io::stdin().read_to_string(&mut seq).unwrap(); + let ilen = seq.len(); + + seq = regex!(">[^\n]*\n|\n").replace_all(&seq, "").into_owned(); + println!("original: {}, replaced: {}", ilen, seq.len()); +} -- cgit v1.2.3