replace the regex crate with the fancy-regex crate (#6227)

This commit is contained in:
Darren Schroeder
2022-08-04 14:51:02 -05:00
committed by GitHub
parent 606547ecb4
commit cdeb8de75d
20 changed files with 227 additions and 111 deletions

View File

@ -11,19 +11,20 @@ version = "0.66.3"
[dependencies]
nu-utils = { path = "../nu-utils", version = "0.66.3" }
nu-path = { path = "../nu-path", version = "0.66.3" }
thiserror = "1.0.31"
miette = { version = "5.1.0", features = ["fancy"] }
serde = {version = "1.0.130", features = ["derive"]}
chrono = { version="0.4.19", features=["serde"] }
indexmap = { version="1.7", features=["serde-1"] }
chrono-humanize = "0.2.1"
byte-unit = "4.0.9"
serde_json = { version = "1.0", optional = true }
nu-json = { path = "../nu-json", version = "0.66.3" }
typetag = "0.1.8"
byte-unit = "4.0.9"
chrono = { version="0.4.19", features=["serde"] }
chrono-humanize = "0.2.1"
fancy-regex = "0.10.0"
indexmap = { version="1.7", features=["serde-1"] }
miette = { version = "5.1.0", features = ["fancy"] }
num-format = "0.4.0"
serde = {version = "1.0.130", features = ["derive"]}
serde_json = { version = "1.0", optional = true }
sys-locale = "0.2.0"
regex = "1.5.4"
thiserror = "1.0.31"
typetag = "0.1.8"
[features]
plugin = ["serde_json"]

View File

@ -13,11 +13,11 @@ use byte_unit::ByteUnit;
use chrono::{DateTime, Duration, FixedOffset};
use chrono_humanize::HumanTime;
pub use custom_value::CustomValue;
use fancy_regex::Regex;
pub use from_value::FromValue;
use indexmap::map::IndexMap;
use num_format::{Locale, ToFormattedString};
pub use range::*;
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::{
borrow::Cow,
@ -2178,7 +2178,11 @@ impl Value {
.map_err(|e| ShellError::UnsupportedInput(format!("{e}"), *rhs_span))?;
let is_match = regex.is_match(lhs);
Ok(Value::Bool {
val: if invert { !is_match } else { is_match },
val: if invert {
!is_match.unwrap_or(false)
} else {
is_match.unwrap_or(true)
},
span,
})
}