1965
MariaDBERRORCommonQueryMEDIUM confidence
Error in regular expression
Production Risk
Low — query is rejected.
What this means
A regular expression passed to REGEXP or REGEXP_LIKE is syntactically invalid. MySQL uses the ICU regular expression library in 8.0 and the POSIX library in earlier versions.
Why it happens
- 1Unmatched parentheses or brackets in a REGEXP pattern.
- 2Invalid escape sequences in the regex pattern.
- 3Using Perl-style regex features not supported by the engine in use.
How to reproduce
trigger — this will error
trigger — this will error
SELECT 'hello' REGEXP '[unclosed';
expected output
ERROR 1965 (HY000): Got error 'Missing ']'' from regexp.
Fix
Fix the regular expression syntax
Fix the regular expression syntax
SELECT 'hello' REGEXP '^h[a-z]+o#x27;;
Why this works
Validate the regex pattern before use; online tools like regex101.com can help debug patterns.
Version notes
Sources
Official documentation ↗
MySQL 8.0 — 1965 ER_SYNTAX_ERROR_OR_ACCESS_VIOLATION_IN_EXCEPT
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev