From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | depesz(at)depesz(dot)com |
Cc: | anudeepvattikonda0404(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #18956: Observing an issue in regexp_count() |
Date: | 2025-06-12 13:54:46 |
Message-ID: | 1203062.1749736486@sss.pgh.pa.us |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
hubert depesz lubaczewski <depesz(at)depesz(dot)com> writes:
> On Thu, Jun 12, 2025 at 08:03:25AM +0000, PG Bug reporting form wrote:
>> I am trying to run the below query
>> select REGEXP_COUNT('cat at the flat', '\Bat\b') ;
>> I was expecting it to return 2 but I see Postgres is returning 0. I see that
>> there are two matches, cat and flat. All it should do is to look for the
>> word at whose left side shoudn't be a word boundary while the right side
>> should be a word boundary
> What makes you think that \B/\b has anything to do with word boundary?
Indeed, they do not.
> As far as I can tell pg regexps have nothing related to word boundaries.
Sure we do, see "Regular Expression Constraint Escapes":
https://www.postgresql.org/docs/current/functions-matching.html#POSIX-CONSTRAINT-ESCAPES-TABLE
Unfortunately, since these are all way outside the POSIX regexp
standard, different systems have implemented these extensions
differently. I don't doubt that \B/\b mean word boundaries
in some other system.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | hubert depesz lubaczewski | 2025-06-12 14:05:34 | Re: BUG #18956: Observing an issue in regexp_count() |
Previous Message | Anthonin Bonnefoy | 2025-06-12 13:04:05 | Re: BUG #18944: Assertion Failure in psql with idle_session_timeout Set |