pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18870: weird behavior with regexp_replace
2+ messages / 2 participants
[nested] [flat]

* BUG #18870: weird behavior with regexp_replace
@ 2025-03-27 13:43  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2025-03-27 13:43 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: devops@key2asset.com

The following bug has been logged on the website:

Bug reference:      18870
Logged by:          reinko
Email address:      devops@key2asset.com
PostgreSQL version: 17.4
Operating system:   Ubuntu 11.4.0-1ubuntu1~22.04
Description:        

select regexp_replace(LOWER('Örebro'), '\W', '_', 'g')  in postgres 15 the
result is örebro which is correct since ö should fit in the \w for a
regex.
select regexp_replace(LOWER('Örebro'), '\W', '_', 'g') --> since postgres 17
the result is _rebro which is incorrect since \w should also contain
characters like ö, ä, ë.

the to lower is not really relevant to this issue the same happens when it's
just a direct string aswell.
this issue happens with alot of special a-z characters é, è have the same
issue for example.

Kind regards,
Reinko Brink



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #18870: weird behavior with regexp_replace
@ 2025-03-27 21:23  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2025-03-27 21:23 UTC (permalink / raw)
  To: devops@key2asset.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> select regexp_replace(LOWER('Örebro'), '\W', '_', 'g')  in postgres 15 the
> result is örebro which is correct since ö should fit in the \w for a
> regex.
> select regexp_replace(LOWER('Örebro'), '\W', '_', 'g') --> since postgres 17
> the result is _rebro which is incorrect since \w should also contain
> characters like ö, ä, ë.

This most likely indicates that you've got a different database
collation selected in the v17 installation.  Postgres defers to
the LC_CTYPE setting (or, in some configurations, the ICU collation)
to decide what is a letter.  See

https://www.postgresql.org/docs/current/charset.html

psql's "\l" command will give a quick overview of what collations
you have selected.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-03-27 21:23 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-03-27 13:43 BUG #18870: weird behavior with regexp_replace PG Bug reporting form <noreply@postgresql.org>
2025-03-27 21:23 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox