Path: redb/redb.SQLite/Data/SqliteRegexFunctions.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.SQLite/Data/SqliteRegexFunctions.cs ---- using System.Text.RegularExpressions; using Microsoft.Data.Sqlite; namespace redb.SQLite.Data { /// /// Regular expressions for queries, on one connection. SQLite has none of its own - X REGEXP Y calls a user /// function that nobody registers - so the query builder translates a LINQ Regex.IsMatch or /// Regex.Replace to these functions, and the expression runs with the .NET semantics it has in memory. /// /// /// NULL in, NULL out, like the built-ins: a NULL match is neither true nor false, so a row with a NULL value is not /// selected by the predicate or by its negation. The match timeout is the process default of /// (REGEX_DEFAULT_MATCH_TIMEOUT), the same an in-memory match uses. /// /// internal static class SqliteRegexFunctions { internal static void Install(SqliteConnection connection) { connection.CreateFunction( "redb_regexp", (input, pattern) => input is null || pattern is null ? (long?)null : Regex.IsMatch(input, pattern) ? 1L : 0L, isDeterministic: true); connection.CreateFunction( "redb_regexp_i", (input, pattern) => input is null || pattern is null ? (long?)null : Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant) ? 1L : 0L, isDeterministic: true); connection.CreateFunction( "redb_regexp_replace", (input, pattern, replacement) => input is null || pattern is null || replacement is null ? null : Regex.Replace(input, pattern, replacement), isDeterministic: true); } } }