mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 08:26:22 +02:00
Change string contains operators to regex (#5117)
This commit is contained in:
@ -3967,9 +3967,9 @@ pub fn parse_operator(
|
||||
b"<=" => Operator::LessThanOrEqual,
|
||||
b">" => Operator::GreaterThan,
|
||||
b">=" => Operator::GreaterThanOrEqual,
|
||||
b"=~" => Operator::Contains,
|
||||
b"=~" => Operator::RegexMatch,
|
||||
b"=^" => Operator::StartsWith,
|
||||
b"!~" => Operator::NotContains,
|
||||
b"!~" => Operator::NotRegexMatch,
|
||||
b"+" => Operator::Plus,
|
||||
b"-" => Operator::Minus,
|
||||
b"*" => Operator::Multiply,
|
||||
|
@ -283,7 +283,7 @@ pub fn math_result_type(
|
||||
},
|
||||
Operator::Equal => (Type::Bool, None),
|
||||
Operator::NotEqual => (Type::Bool, None),
|
||||
Operator::Contains => match (&lhs.ty, &rhs.ty) {
|
||||
Operator::RegexMatch => match (&lhs.ty, &rhs.ty) {
|
||||
(Type::String, Type::String) => (Type::Bool, None),
|
||||
(Type::Any, _) => (Type::Bool, None),
|
||||
(_, Type::Any) => (Type::Bool, None),
|
||||
@ -301,7 +301,7 @@ pub fn math_result_type(
|
||||
)
|
||||
}
|
||||
},
|
||||
Operator::NotContains => match (&lhs.ty, &rhs.ty) {
|
||||
Operator::NotRegexMatch => match (&lhs.ty, &rhs.ty) {
|
||||
(Type::String, Type::String) => (Type::Bool, None),
|
||||
(Type::Any, _) => (Type::Bool, None),
|
||||
(_, Type::Any) => (Type::Bool, None),
|
||||
|
Reference in New Issue
Block a user