SQL pattern tester: LIKE and regular expressions
Type a LIKE pattern, a regular expression or both, paste in some test strings, and see which strings each one matches and which part the regex hit. Pick the engine first, because the same pattern behaves differently on PostgreSQL, MySQL, SQL Server, SQLite and Oracle. Everything runs in your browser: nothing you type is sent anywhere.
Resultados
| Test string | LIKE | Regex |
|---|
Equivalent WHERE clause
WHERE name LIKE 'App%'
How PostgreSQL treats these patterns
LIKE (PostgreSQL). Case-sensitive: App% matches "Application" but not "APP-99"; use ILIKE to ignore case. Backslash is the default escape character, so \% is a literal percent sign even without an ESCAPE clause.
Regular expressions (PostgreSQL). Supported natively: ~ (case-sensitive), ~* (case-insensitive) and the SQL-standard SIMILAR TO.
How LIKE works in each engine
LIKE has exactly two wildcards: % for any run of characters and _
for exactly one. It must match the whole string, so App% does not match
"MyApplication". Case and accent sensitivity come from the collation, and the defaults differ
per engine, so the same query can return different rows on two databases.
- PostgreSQL. Case-sensitive with the default collations. Use
ILIKEto ignore case. Backslash is the default escape character:LIKE '50\%'matches only "50%". - MySQL. Follows the collation of the column. The MySQL 8 default
utf8mb4_0900_ai_ciis case- and accent-insensitive, soLIKE 'app%'matches "Application" andLIKE 'cafe'matches "café". A_binou_as_cscollation makes it strict. Backslash is the default escape character, as in PostgreSQL. - SQL Server. Also follows the column collation; the common defaults (
SQL_Latin1_General_CP1_CI_ASand friends) ignore case but not accents. T-SQL adds[a-f]sets and[^a-f]negation, which the other engines treat as literal brackets. Ranges follow collation order, so under a CI_AS collation[a-z]also matches "Z" and "é". - SQLite. Case-insensitive for ASCII letters only, by design and unchangeable without
PRAGMA case_sensitive_like. "ä" matching "Ä" is out of scope for the built-in LIKE. - Oracle. Always case-sensitive, like PostgreSQL. Case-insensitive matching needs
UPPER()on both sides or NLS_COMP/NLS_SORT session settings. - Escaping. Every engine supports
ESCAPEto match a literal%ou_. Without it, PostgreSQL and MySQL still treat backslash as the escape character; SQL Server, Oracle and SQLite treat it as an ordinary character. Oracle is also the strict one: its escape character may only precede%,_or itself, and anything else fails with ORA-01424. Enter an escape character above and the tester uses it instead of the engine default.
Regular expressions in each engine
Regex is much less portable than LIKE. Not every engine has it, and the ones that do each picked their own flavor and operator.
- PostgreSQL. The richest set:
~(case-sensitive),~*(case-insensitive),!~/!~*for negation, plus the SQL-standardSIMILAR TO, which mixes LIKE wildcards with regex syntax. Flavor: Advanced Regular Expressions, a superset of POSIX extended with lookahead, lookbehind and backreferences. One trap:\bmeans backspace there, and the word boundary is written\y. - MySQL 8+.
REGEXP_LIKE(),REGEXPeRLIKEwith the ICU library. Case sensitivity follows the collation, so it is usually insensitive unless you pass the'c'match type. Backslashes must be doubled inside MySQL string literals:'\\d'. MariaDB uses PCRE, which is close but not identical. - Oracle.
REGEXP_LIKE(column, 'pattern')in WHERE clauses, plusREGEXP_INSTR,REGEXP_REPLACEeREGEXP_SUBSTR. Flavor: POSIX extended with Perl-style\d,\we\sand backreferences, but no lookaround. Inside brackets a backslash is an ordinary character, so[\w-]means a backslash, a w or a hyphen. Pass'i'to ignore case. - SQL Server. SQL Server 2025 and Azure SQL Database have
REGEXP_LIKE,REGEXP_REPLACEand the other REGEXP_ functions, built on Google's RE2 library (no backreferences or lookaround) and available at database compatibility level 170.REGEXP_LIKEis case-sensitive unless you pass'i', whatever the collation. On SQL Server 2022 and earlier the options are LIKE wildcards, including the[a-f]sets, or a SQL CLR function that hosts a .NET regex. - SQLite. No regular expression support built in.
REGEXPis a placeholder that works only after your application registers a user-defined function withsqlite3_create_function. - What this page matches with. The tester uses the browser's JavaScript regex engine, after translating what the engine reads differently: POSIX classes such as
[[:alpha:]](Unicode letters, or ASCII only for SQL Server),\w(Unicode letters outside SQL Server), PostgreSQL's\be\y, and Oracle's literal backslash inside brackets. A backreference or lookaround on SQL Server, or a lookaround on Oracle, is reported instead of matched, because those engines reject it or match it differently. The generated WHERE clause states the case sensitivity explicitly, so it matches the way this page does.
Example: one pattern, two engines
Executar App% against "Application" and "APP-99" and PostgreSQL and SQL Server
already disagree.
LIKE 'App%' on PostgreSQL
WHERE name LIKE 'App%' matches: Application (App + any run of characters) misses: APP-99 (LIKE is case-sensitive on PostgreSQL) misses: grapple (LIKE matches the whole string, and grapple does not start with App)
LIKE 'App%' on SQL Server (default collation)
WHERE name LIKE 'App%' matches: Application (same as PostgreSQL) matches: APP-99 (the CI_ collation ignores case) matches: apple (so does this one) misses: grapple
A literal percent sign, with ESCAPE
-- "50%" is stored in the name column; find it exactly: WHERE name LIKE '%50\%%' ESCAPE '\' -- the first \% means a literal % sign, the last % is still a wildcard -- (in MySQL, double the backslashes inside the literals: '%50\\%%' ESCAPE '\\')
Enter \ in the escape box above and the tester honors it exactly like this query
does: an escaped % ou _ becomes a literal character instead of a
wildcard.
Pattern tester FAQ
Is this SQL pattern tester free?
Yes. There is no sign-up and no usage limit. It exists so you can see where the engines disagree about wildcards and regex before your query does it for you.
Are my patterns and test strings sent to a server?
No. The matching runs in JavaScript inside your browser tab. Your patterns and test strings are never uploaded, logged or stored, and once the page has loaded it keeps working offline. The copy-link button puts your test in the part of the URL after the #, which browsers do not send to the server, so a link only reaches whoever you give it to.
Is SQL LIKE case-sensitive?
It depends on the engine. PostgreSQL and Oracle match LIKE case-sensitively, and SQLite ignores case for ASCII letters only. MySQL and SQL Server follow the collation of the column: SQL Server's usual CI_AS defaults ignore case but not accents, and MySQL 8's utf8mb4_0900_ai_ci ignores both, so 'cafe' matches 'Café'. The tool applies the rule for the engine you pick.
How do I match a literal % or _ in a LIKE pattern?
Put an escape character before the wildcard you want literally and name it in an ESCAPE clause: LIKE '50!%' ESCAPE '!' matches "50%" instead of "50" followed by anything. All five engines support ESCAPE. PostgreSQL and MySQL also treat backslash as the escape character when there is no ESCAPE clause, so '50\%' already means a literal percent sign there; SQL Server, Oracle and SQLite have no default. SQL Server can also wrap the wildcard in brackets: '50[%]'.
Which regex flavor does my database use?
PostgreSQL uses its Advanced Regular Expressions, a superset of POSIX extended, with ~, ~* and the SQL-standard SIMILAR TO. MySQL 8+ uses ICU regular expressions with REGEXP and REGEXP_LIKE. Oracle uses POSIX extended regular expressions with Perl-style \d, \w and \s in REGEXP_LIKE. SQL Server 2025 and Azure SQL Database have REGEXP_LIKE built on the RE2 library; older SQL Server versions need LIKE wildcards or a SQL CLR function. SQLite only knows REGEXP if your application registers a function for it.
Why can the regex result here differ from my database?
This page matches with the browser's JavaScript regex engine, after translating the parts each engine reads differently: POSIX classes like [[:alpha:]], \w (Unicode letters everywhere except SQL Server), PostgreSQL's \b (a backspace there; its word boundary is \y) and Oracle's literal backslash inside brackets. The flavors also part ways on advanced features: RE2 (SQL Server) has no backreferences or lookaround, Oracle has backreferences but no lookaround, and PostgreSQL and ICU (MySQL) support both. The tester reports those cases instead of matching them, and the column collation can still change a result in your database.
Pattern works? Run it against the real table in SQLly
A native SQL workbench for macOS, Windows and Linux with IntelliSense that knows your schema, guardrails for risky queries, and the formatter from our other tools built into the editor.