pub enum RegexError {
Show 16 variants
ClassEscape,
BackReference,
ConstraintEscape,
OtherEscape,
Lookaround,
EmbeddedOption,
Comment,
Director,
CollatingElement,
BracketForm,
BoundPastDupmax,
BoundForm,
QuantifierOperand,
Unbalanced,
TooDeep,
TooLarge,
}Expand description
Why PgRegex::new refuses a pattern, naming its first construct outside the subset, which
PostgreSQL may take or refuse.
use sql_values::postgres::{PgRegex, RegexError};
assert_eq!(PgRegex::new(r"\d+").unwrap_err(), RegexError::ClassEscape);
assert_eq!(PgRegex::new("(?=a)").unwrap_err(), RegexError::Lookaround);
assert_eq!(PgRegex::new("a{256}").unwrap_err(), RegexError::BoundPastDupmax);
assert_eq!(
PgRegex::new(r"(a)\1").unwrap_err().to_string(),
"the regular expression subset takes no back reference",
);Variants§
ClassEscape
\d, \s, \w or their uppercase negations, in or out of a bracket expression.
BackReference
\ and a nonzero digit outside a bracket expression.
ConstraintEscape
\A, \Z, \m, \M, \y or \Y outside a bracket expression.
OtherEscape
Any other \, such as a character-entry escape like \n or \x41, an escape inside a
bracket expression, an escape PostgreSQL refuses, or a \ ending the pattern.
Lookaround
(?=, (?!, (?<= or (?<!.
EmbeddedOption
(? and a letter, such as (?i).
Comment
(?#.
Director
*** opening the pattern, such as ***=.
CollatingElement
A collating element such as [.a.] or an equivalence class such as [=a=] inside a
bracket expression.
BracketForm
A bracket expression opening with ], holding a - that is neither first, last nor
between the ends of a range, holding a range whose end precedes its start or is a
character class, or naming a character class PostgreSQL does not know.
BoundPastDupmax
A count in a bound past 255, PostgreSQL’s DUPMAX.
BoundForm
A { opening no {m}, {m,} or {m,n} closed by }, or a bound whose n is below its
m.
QuantifierOperand
A quantifier after nothing, after ( or |, after an anchor, or after another
quantifier and its optional non-greedy ?.
Unbalanced
A ( without its ), a bracket expression without its ], or a ), ] or } without
its opener.
TooDeep
Groups nested past 64 deep.
TooLarge
A pattern past 10000 elements once its bounded repetitions are copied out, as PostgreSQL’s compiler copies them, an element weighing more for every 32 arcs its colours may draw, or a pattern that may split the characters into more than 16000 colours.
Trait Implementations§
Source§impl Clone for RegexError
impl Clone for RegexError
impl Copy for RegexError
Source§impl Debug for RegexError
impl Debug for RegexError
Source§impl Display for RegexError
impl Display for RegexError
impl Eq for RegexError
Source§impl Error for RegexError
impl Error for RegexError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()