Skip to main content

regexp_replace_flags

Function regexp_replace_flags 

Source
pub fn regexp_replace_flags<'a, V, E, P, R, F>(
    expr: E,
    pattern: P,
    replacement: R,
    flags: F,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Text, E::Nullable, <<<E::Aggregate as AggOr<P::Aggregate>>::Output as AggOr<R::Aggregate>>::Output as AggOr<F::Aggregate>>::Output>
Expand description

REGEXP_REPLACE with flags - replaces substrings matching a POSIX regex (PostgreSQL).

Common flags: "g" (global), "i" (case-insensitive), "gi" (both).

ยงExample

use drizzle_core::expr::regexp_replace_flags;

// SELECT REGEXP_REPLACE(users.phone, '[^0-9]', '', 'g')
let digits_only = regexp_replace_flags(users.phone, "[^0-9]", "", "g");