From 1282d3a2709064cb847b8757409a7153449faa9d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 22 Oct 2025 21:21:17 +0200 Subject: PostgreSQL: compatibility with PCRE word boundary (#8141) Allow the use of regex `\b` for word boundary (and `\B` for the opposite) even when using PostgreSQL. Follow up of: * https://github.com/FreshRSS/FreshRSS/pull/6706 For instance, `intitle:/\bnew\B/` will find *newest* but not *new* nor *renewal*. Useful in particular to minimise the differences between PHP and database in: * https://github.com/FreshRSS/FreshRSS/pull/7959 --- tests/app/Models/SearchTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/app') diff --git a/tests/app/Models/SearchTest.php b/tests/app/Models/SearchTest.php index 90aca6a24..b7cb43f8f 100644 --- a/tests/app/Models/SearchTest.php +++ b/tests/app/Models/SearchTest.php @@ -751,6 +751,11 @@ final class SearchTest extends \PHPUnit\Framework\TestCase { '(e.content ~ ? )', ['^ab\\M'] ], + [ + 'intitle:/\\b\\d+/', + '(e.title ~ ? )', + ['\\y\\d+'] + ], [ 'author:/^ab$/', "(REPLACE(e.author, ';', '\n') ~ ? )", @@ -819,6 +824,11 @@ final class SearchTest extends \PHPUnit\Framework\TestCase { "(e.title REGEXP ? )", ['(?-i)(?m)^ab$'] ], + [ + 'intitle:/\\b\\d+/', + "(e.title REGEXP ? )", + ['(?-i)\\b\\d+'] + ], [ 'intext:/^ab$/m', '(UNCOMPRESS(e.content_bin) REGEXP ?) )', -- cgit v1.2.3