From 341b56f1490482ca126bb3d925b4f99cbd17f0dc Mon Sep 17 00:00:00 2001 From: Ben Davis Date: Fri, 9 Feb 2024 17:54:14 -0600 Subject: [PATCH] Use minimal regex/fancy-regex build features to reduce build size --- Cargo.toml | 12 ++++++++++-- src/matching/mod.rs | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9965217..7d33697 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,13 +15,21 @@ maintenance = { status = "passively-maintained" } [dependencies] derive_builder = { version = "0.12.0", optional = true } -fancy-regex = "0.11.0" itertools = "0.10.0" lazy_static = "1.3" quick-error = "2.0" -regex = "1" time = { version = "0.3" } +[dependencies.regex] +version = "1" +default-features = false +features = ["std"] + +[dependencies.fancy-regex] +version = "0.13.0" +default-features = false +features = ["std"] + [target.'cfg(target_arch = "wasm32")'.dependencies] js-sys = "0.3.56" diff --git a/src/matching/mod.rs b/src/matching/mod.rs index cefe10f..7d91992 100644 --- a/src/matching/mod.rs +++ b/src/matching/mod.rs @@ -848,7 +848,7 @@ lazy_static! { table }; static ref MAYBE_DATE_NO_SEPARATOR_REGEX: Regex = Regex::new(r"^[0-9]{4,8}$").unwrap(); - static ref MAYBE_DATE_WITH_SEPARATOR_REGEX: Regex = Regex::new(r"^([0-9]{1,4})([\s/\\_.-])([0-9]{1,2})([\s/\\_.-])([0-9]{1,4})$").unwrap(); + static ref MAYBE_DATE_WITH_SEPARATOR_REGEX: Regex = Regex::new(r"^([0-9]{1,4})([ \t\r\n/\\_.-])([0-9]{1,2})([[ \t\r\n/\\_.-]/\\_.-])([0-9]{1,4})$").unwrap(); } #[cfg(test)]