forked from extern/nushell
replace the regex crate with the fancy-regex crate (#6227)
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
use super::{operations::Axis, NuDataFrame};
|
||||
|
||||
use nu_protocol::{ast::Operator, span, ShellError, Span, Spanned, Value};
|
||||
use num::Zero;
|
||||
use polars::prelude::{
|
||||
@ -294,7 +293,7 @@ pub(super) fn compute_series_single_value(
|
||||
compare_series_decimal(&lhs, *val, ChunkedArray::equal, lhs_span)
|
||||
}
|
||||
Value::String { val, .. } => {
|
||||
let equal_pattern = format!("^{}$", regex::escape(val));
|
||||
let equal_pattern = format!("^{}$", fancy_regex::escape(val));
|
||||
contains_series_pat(&lhs, &equal_pattern, lhs_span)
|
||||
}
|
||||
Value::Date { val, .. } => {
|
||||
@ -406,7 +405,7 @@ pub(super) fn compute_series_single_value(
|
||||
},
|
||||
Operator::StartsWith => match &right {
|
||||
Value::String { val, .. } => {
|
||||
let starts_with_pattern = format!("^{}", regex::escape(val));
|
||||
let starts_with_pattern = format!("^{}", fancy_regex::escape(val));
|
||||
contains_series_pat(&lhs, &starts_with_pattern, lhs_span)
|
||||
}
|
||||
_ => Err(ShellError::OperatorMismatch {
|
||||
@ -419,7 +418,7 @@ pub(super) fn compute_series_single_value(
|
||||
},
|
||||
Operator::EndsWith => match &right {
|
||||
Value::String { val, .. } => {
|
||||
let ends_with_pattern = format!("{}$", regex::escape(val));
|
||||
let ends_with_pattern = format!("{}$", fancy_regex::escape(val));
|
||||
contains_series_pat(&lhs, &ends_with_pattern, lhs_span)
|
||||
}
|
||||
_ => Err(ShellError::OperatorMismatch {
|
||||
|
Reference in New Issue
Block a user