pub enum Regex<T> {
Show 14 variants
Begin,
End,
Satisfy(Rc<dyn Fn(&T) -> bool>),
NotSatisfy(Rc<dyn Fn(&T) -> bool>),
Concat(Rc<Regex<T>>, Rc<Regex<T>>),
Group(Rc<Regex<T>>),
NamedGroup(String, Rc<Regex<T>>),
NonCapturingGroup(Rc<Regex<T>>),
Or(Rc<Regex<T>>, Rc<Regex<T>>),
ZeroOrOne(Rc<Regex<T>>, bool),
Repeat0(Rc<Regex<T>>, bool),
Repeat1(Rc<Regex<T>>, bool),
RepeatN(Rc<Regex<T>>, usize),
RepeatMinMax(Rc<Regex<T>>, usize, Option<usize>, bool),
}
Variants§
Begin
Like a ‘^’ in ragex. Regex that matches the beginning of the input.
End
Like a ‘$’ in ragex. Regex that matches the end of the input.
Satisfy(Rc<dyn Fn(&T) -> bool>)
Like a [character class]
in regex. Regex that matches any values that satisfy the given predicate.
NotSatisfy(Rc<dyn Fn(&T) -> bool>)
Like a [^character class]
in regex. Regex that matches any values that not satisfy the given predicate.
Concat(Rc<Regex<T>>, Rc<Regex<T>>)
Like a RS
in regex. Concatenate two regex.
Group(Rc<Regex<T>>)
Like a (R)
in regex. Numbered capturing group (submatch).
NamedGroup(String, Rc<Regex<T>>)
Like a (?<name>R)
in regex. Numbered capturing group (submatch).
NonCapturingGroup(Rc<Regex<T>>)
Like a (?:R)
in regex. Numbered non-capturing group.
Or(Rc<Regex<T>>, Rc<Regex<T>>)
Like a R|S
in regex. Regex alternation.
ZeroOrOne(Rc<Regex<T>>, bool)
Like a ?
, ??
in regex. Regex zero or one.
Repeat0(Rc<Regex<T>>, bool)
Like a *
, *?
in regex. Regex zero or one.
Repeat1(Rc<Regex<T>>, bool)
Like a +
, +?
in regex. Regex one or more.
RepeatN(Rc<Regex<T>>, usize)
Like a {n}
in regex. Exactly N-times.
RepeatMinMax(Rc<Regex<T>>, usize, Option<usize>, bool)
Like a {n,m}
, {n,m}?
or {n,}
, {n,}?
in regex. n or n+1 or .. m times.
Implementations§
Source§impl<T: 'static> Regex<T>
impl<T: 'static> Regex<T>
Sourcepub fn satisfy(f: impl Fn(&T) -> bool + 'static) -> Self
pub fn satisfy(f: impl Fn(&T) -> bool + 'static) -> Self
Like a [character class]
in regex. Build regex that matches any value that satisfies the given predicate.
Sourcepub fn not_satisfy(f: impl Fn(&T) -> bool + 'static) -> Self
pub fn not_satisfy(f: impl Fn(&T) -> bool + 'static) -> Self
Like a [^character class]
in regex. Build regex that matches any value that not satisfies the given predicate.
Sourcepub fn zero_or_one(reg: Self, greedy: bool) -> Self
pub fn zero_or_one(reg: Self, greedy: bool) -> Self
Like a ?
, ??
in regex. Build regex that matches underlying regex zero or one times.
Sourcepub fn repeat1(reg: Self, greedy: bool) -> Self
pub fn repeat1(reg: Self, greedy: bool) -> Self
Like a +
, +?
in regex. Build regex that matches underlying regex one or more.
Sourcepub fn repeat0(reg: Self, greedy: bool) -> Self
pub fn repeat0(reg: Self, greedy: bool) -> Self
Like a *
, *?
in regex. Build regex that matches underlying regex zero or more.
Sourcepub fn repeat_n(reg: Self, n: usize) -> Self
pub fn repeat_n(reg: Self, n: usize) -> Self
Like a {n}
in regex. Build regex that matches underlying regex N-times.
Sourcepub fn repeat_n_or_more(reg: Self, n: usize, greedy: bool) -> Self
pub fn repeat_n_or_more(reg: Self, n: usize, greedy: bool) -> Self
Like a {n,}
, {n,}?
in regex. Build regex that matches underlying regex N-times or more.
Sourcepub fn repeat_min_max(reg: Self, n: usize, m: usize, greedy: bool) -> Self
pub fn repeat_min_max(reg: Self, n: usize, m: usize, greedy: bool) -> Self
Like a {n,m}
, {n,m}?
in regex. Build regex that matches underlying regex n or n + 1 or … or m times.
Sourcepub fn non_capturing_group(r: Self) -> Self
pub fn non_capturing_group(r: Self) -> Self
Like a (?:R)
in regex. Numbered capturing group (submatch).
Sourcepub fn named_group(name: &str, r: Self) -> Self
pub fn named_group(name: &str, r: Self) -> Self
Like a (?P<name>R)
in regex. Numbered capturing group (submatch).