Introducing our new eBook: "Best Practices for Optimizing Postgres Query Performance"Download Now

U131: Invalid regular expression

Category: Application / User Errors
SQLSTATE: 2201B (Class 22 — Data Exception: invalid_regular_expression)
Urgency: low

Example Postgres Log Output:

ERROR: invalid regular expression: quantifier operand invalid
STATEMENT: SELECT regexp_replace('test', '<(?i:test)', '');

Explanation:

The regular expression is not valid. This usually happens when you made a typo in the pattern, or if you've used a non-portable expression that doesn't work in Postgres' regexp parser.

PostgreSQL uses a variant of the POSIX regular expression engine, which is a superset of the POSIX ERE form. Note that in particular that this is slightly different than the widely used PCRE expression engine used in many server-side languages.

Recommended Action:

Fix the regular expression syntax.

Learn More:


Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →