pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Søren Vainio <sva@Netpointers.com>
Cc: 'Andreas Joseph Krogh' <andreak@officenet.no>
Cc: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Re: Scadinavian characters in regular expressions
Date: Tue, 09 Apr 2002 09:33:55 -0400
Message-ID: <28561.1018359235@sss.pgh.pa.us> (raw)
In-Reply-To: <910513A5A944D5118BE900C04F67CB5A1F82C6@MAIL>
References: <910513A5A944D5118BE900C04F67CB5A1F82C6@MAIL>

=?iso-8859-1?Q?S=F8ren_Vainio?= <sva@Netpointers.com> writes:
> Using \s does produce FALSE for SELECT 'oneå two three' ~
> '^[^\s]+[\s][^\s]+$';
> But it also produces FALSE for any two-word string ex:
> SELECT 'one two' ~ '^[^\s]+[\s][^\s]+$'; where I would expect TRUE???
> (I am using PostgreSQL 7.1.3)

I do not believe that Postgres' regular expression engine recognizes \s
as meaning anything except "s".  See
http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/functions-matching.html

In the above, it's even worse: the backslashes were eaten by the
string-literal parser, so what arrived at the RE engine was just
^[^s]+[s][^s]+$ ... not likely to produce what you wanted.

As for the original issue, I wonder whether you are storing the string
as UTF-8 or Latin1 encoding.  I have a suspicion that the å (&#229
&aring a-ring) is actually a multibyte sequence inside the database
and for some reason Postgres isn't configured to recognize it as a
single logical character.

			regards, tom lane



view thread (7+ messages)  latest in thread

Message-ID: <28561.1018359235@sss.pgh.pa.us>
Permalink:  ../28561.1018359235@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28561.1018359235@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, sva@Netpointers.com, andreak@officenet.no
  Subject: Re: Scadinavian characters in regular expressions
  In-Reply-To: <28561.1018359235@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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