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 AggOr<P::Aggregate>>::Output as AggOr<R::Aggregate>>::Output>where
V: SQLParam + 'a,
V::DialectMarker: PostgresStringSupport,
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,
E::Aggregate: AggOr<P::Aggregate>,
<E::Aggregate as AggOr<P::Aggregate>>::Output: AggOr<R::Aggregate>,Expand description
REGEXP_REPLACE - replaces substrings matching a POSIX regex (PostgreSQL).
Replaces the first match of pattern in expr with replacement.
Use optional flags (e.g., "g" for global) via regexp_replace_flags.
ยงExample
use drizzle_core::expr::regexp_replace;
// SELECT REGEXP_REPLACE(users.phone, '[^0-9]', '')
let digits_only = regexp_replace(users.phone, "[^0-9]", "");