pub fn regexp_replace<'a, V, E, P, R>(
expr: E,
pattern: P,
replacement: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Text, E::Nullable, <<E::Aggregate as AggregateKind>::Or<P::Aggregate> as AggregateKind>::Or<R::Aggregate>, (E::Sources, (P::Sources, R::Sources))>where
V: SQLParam + 'a,
V::DialectMarker: DialectSupports<PostgresString>,
E: Expr<'a, V>,
E::SQLType: Textual,
P: Expr<'a, V>,
P::SQLType: Textual,
P::Aggregate: AggregateKind,
R: Expr<'a, V>,
R::SQLType: Textual,
R::Aggregate: AggregateKind,Expand description
Replaces the first POSIX regular expression match (REGEXP_REPLACE), on PostgreSQL.
All arguments must be text. The result is text and keeps expr’s
nullability. To replace every match, use regexp_replace_flags with
"g".
§Examples
let cleaned = regexp_replace(users.name, "[^a-z]", "");
assert_eq!(cleaned.sql(), r#"REGEXP_REPLACE ("users"."name", $1, $2)"#);