DatabaseStatusSyntax FamilyMin Version
PostgreSQL full posix-operators -
MySQL full regexp-operator -
MariaDB full regexp-operator -
Oracle full regexp-functions 10g
SQL Server workaround - -
SQLite extension regexp-operator -
Redshift full posix-operators -
DB2 full regexp-functions -
Snowflake full regexp-operator -
BigQuery full regexp-functions -

Compare Databases

Database Details

PostgreSQL full
-- Operator syntax
SELECT * FROM users WHERE email ~ '^[a-z]+@example\.com$';

-- Case-insensitive
SELECT * FROM users WHERE email ~* '^[A-Z]+@example\.com$';

-- Function syntax
SELECT * FROM users WHERE regexp_like(email, '^[a-z]+@example\.com$');
  • Supports ~ (match), ~* (case-insensitive match), !~ (not match), !~* (case-insensitive not match) operators.
  • Also provides regexp_like(), regexp_replace(), regexp_match(), and regexp_matches() functions.
  • Uses POSIX Advanced Regular Expressions (ARE).
MySQL full
-- REGEXP operator
SELECT * FROM users WHERE email REGEXP '^[a-z]+@example\\.com$';

-- REGEXP_LIKE function (8.0+)
SELECT * FROM users WHERE REGEXP_LIKE(email, '^[a-z]+@example\\.com$');
  • REGEXP and RLIKE operators available in all versions.
  • MySQL 8.0+ uses ICU regex library with full Unicode support.
  • Also provides REGEXP_REPLACE(), REGEXP_INSTR(), and REGEXP_SUBSTR() from 8.0+.
MariaDB full
SELECT * FROM users WHERE email REGEXP '^[a-z]+@example\.com$';

SELECT REGEXP_REPLACE(email, '@.*$', '@redacted.com') FROM users;
  • REGEXP / RLIKE operator for pattern matching.
  • REGEXP_LIKE(), REGEXP_REPLACE(), REGEXP_SUBSTR(), REGEXP_INSTR() functions available.
  • Uses POSIX regular expressions.
  • REGEXP is case-insensitive by default (unless BINARY is used).
  • REGEXP_REPLACE and related functions added in MariaDB 10.0.5.
Docs: REGEXP
Oracle full
SELECT * FROM users WHERE REGEXP_LIKE(email, '^[a-z]+@example\.com$', 'i');
  • Provides REGEXP_LIKE, REGEXP_REPLACE, REGEXP_INSTR, REGEXP_SUBSTR, and REGEXP_COUNT.
  • Supports match parameter flags: 'i' (case-insensitive), 'c' (case-sensitive), 'm' (multiline), 'n' (dot matches newline).
  • Uses POSIX Extended Regular Expression (ERE) syntax with some extensions.
SQL Server workaround
-- No native regex; use LIKE for simple patterns
SELECT * FROM users WHERE email LIKE '%@example.com';

-- Or use CLR integration for full regex
-- dbo.RegexMatch(email, '^[a-z]+@example\.com$')
  • SQL Server has no built-in regular expression matching.
  • LIKE and PATINDEX support limited wildcard patterns (%, _, []) but not full regex.
  • Full regex can be achieved via CLR user-defined functions or external scripts.
SQLite extension
-- Requires a user-defined regexp() function to be loaded
SELECT * FROM users WHERE email REGEXP '^[a-z]+@example\.com$';
  • SQLite parses the REGEXP operator but does not include a built-in implementation.
  • A user-defined regexp() function must be registered via the application or a loadable extension.
  • The popular sqlite3 CLI does not include regexp support by default; extensions like regexp.c or the CLI -cmd flag can add it.
Redshift full
-- Case-sensitive POSIX match
SELECT email FROM users WHERE email ~ '^[a-z]+@[a-z]+\.[a-z]+$';

-- Case-insensitive match
SELECT email FROM users WHERE email ~* '^[a-z]+@[a-z]+\.[a-z]+$';

SELECT REGEXP_REPLACE(email, '@.*$', '@redacted.com') FROM users;
  • ~ operator (case-sensitive POSIX match), ~* (case-insensitive), !~ (not match), !~* (not match case-insensitive).
  • REGEXP_REPLACE(str, pattern, replace), REGEXP_INSTR(str, pattern), REGEXP_SUBSTR(str, pattern), REGEXP_COUNT(str, pattern) available.
  • PostgreSQL-style regex operators.
  • SIMILAR TO for SQL-standard pattern matching.
DB2 full
SELECT * FROM users WHERE REGEXP_LIKE(email, '^[a-z]+@example\.com$', 'i');

SELECT REGEXP_REPLACE(email, '@.*$', '@redacted.com') FROM users;
  • REGEXP_LIKE(str, pattern [, flags]), REGEXP_EXTRACT(str, pattern), REGEXP_REPLACE(str, pattern, replace), REGEXP_SUBSTR(str, pattern) available.
  • REGEXP functions added in DB2 10.5.
  • Uses POSIX regular expressions.
  • Case-insensitive matching with 'i' flag.
Snowflake full
SELECT * FROM users WHERE email RLIKE '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$';

SELECT REGEXP_REPLACE(email, '@.*$', '@redacted.com') FROM users;
  • REGEXP (alias RLIKE / REGEXP_LIKE) operator available.
  • REGEXP_LIKE(str, pattern), REGEXP_REPLACE(str, pattern, replace), REGEXP_SUBSTR(str, pattern, pos, occ, flags), REGEXP_INSTR(), REGEXP_COUNT() available.
  • Snowflake uses RE2 regular expression syntax (not PCRE).
  • 'i' flag for case-insensitive matching.
  • RLIKE is a SQL operator alias: col RLIKE 'pattern'.
BigQuery full
SELECT email FROM users
WHERE REGEXP_CONTAINS(email, r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$');

SELECT REGEXP_REPLACE(email, r'@.*$', '@redacted.com') FROM users;
  • REGEXP_CONTAINS(str, pattern), REGEXP_EXTRACT(str, pattern), REGEXP_EXTRACT_ALL(str, pattern), REGEXP_REPLACE(str, pattern, replace), REGEXP_INSTR(str, pattern) available.
  • Uses RE2 regular expression syntax.
  • REGEXP_CONTAINS is the match function.
  • No ~ operator; use REGEXP_CONTAINS.