regex Quantifiers {m,n}, m can be negative, n greater than 255

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: regex Quantifiers {m,n}, m can be negative, n greater than 255
Date: 2025-12-11 12:56:03
Message-ID: CACJufxG9r3bKa0BQLKpqT6BRKATuiCaK-=mnzQit9UWswDgVGw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi.

""
The forms using {...} are known as bounds. The numbers m and n within a bound
are unsigned decimal integers with permissible values from 0 to 255 inclusive.
""
Table (Regular Expression Quantifiers)
https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP

select regexp_matches(E'abc', 'a{0,257}.');
select regexp_matches(E'abc', 'a{-0,257}.');
select regexp_matches(E'abc', 'a{-1,2}.');

based on the manual description, the second and the third query should
error out?
test_regex.sql (begin with line 223) have many tests but no tests for
negative value.

--
jian
https://www.enterprisedb.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2025-12-11 13:17:21 Re: tablecmds: Open pg_class only when an update is required
Previous Message Maxim Orlov 2025-12-11 12:47:53 Re: POC: make mxidoff 64 bits