Function magic_regexp::not
source · pub fn not(t: Type<'_>) -> Type<'_>
Expand description
Returns the opposite of the given type.
For example, Type::Digit
will return Type::NotDigit
.
Returns the same type if it is not a type that can be negated.
Panics, if the given type is Type::Options
and the given string is empty.
§Examples
use magic_regexp::{OneOrMore, not, Options};
let input = OneOrMore(not(not(Options("01"))));
assert_eq!(input.to_string(), r"([01]+)");