Received: from mail.netpointers.com (unknown [212.130.10.187]) by postgresql.org (Postfix) with ESMTP id 80E9A475BA9 for ; Tue, 9 Apr 2002 04:50:45 -0400 (EDT) Received: by MAIL with Internet Mail Service (5.5.2650.21) id ; Tue, 9 Apr 2002 10:51:34 +0200 Message-ID: <910513A5A944D5118BE900C04F67CB5A1F82C5@MAIL> From: =?iso-8859-1?Q?S=F8ren_Vainio?= To: "'pgsql-sql@postgresql.org'" Subject: Scadinavian characters in regular expressions Date: Tue, 9 Apr 2002 10:51:33 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C1DFA3.C0227110" X-Archive-Number: 200204/91 X-Sequence-Number: 7356 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C1DFA3.C0227110 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Can someone please explain the following? I am using a regular expression to find strings containing two words (begin with one or more characters not being spaces followed by a space followed by one or more characters not being spaces). But when scandinavian characters are included it returns different results depending on where the character is positioned. The first two-word example returns TRUE as expected. The second three-word example returns FALSE as expected. But when I let an =E5 (å å a-ring) traverse through the string it unexpectedly returns TRUE when the character is positioned as the second-last or last character in the two first words. =20 SELECT 'one two' ~ '^[^ ]+[ ][^ ]+$'; returns TRUE SELECT 'one two three' ~ '^[^ ]+[ ][^ ]+$'; returns FALSE SELECT '=E5one two three' ~ '^[^ ]+[ ][^ ]+$'; returns FALSE SELECT 'o=E5ne two three' ~ '^[^ ]+[ ][^ ]+$'; returns FALSE SELECT 'on=E5e two three' ~ '^[^ ]+[ ][^ ]+$'; returns TRUE SELECT 'one=E5 two three' ~ '^[^ ]+[ ][^ ]+$'; returns TRUE SELECT 'one =E5two three' ~ '^[^ ]+[ ][^ ]+$'; returns FALSE SELECT 'one t=E5wo three' ~ '^[^ ]+[ ][^ ]+$'; returns FALSE SELECT 'one tw=E5o three' ~ '^[^ ]+[ ][^ ]+$'; returns TRUE SELECT 'one two=E5 three' ~ '^[^ ]+[ ][^ ]+$'; returns TRUE SELECT 'one two =E5three' ~ '^[^ ]+[ ][^ ]+$'; returns FALSE SELECT 'one two t=E5hree' ~ '^[^ ]+[ ][^ ]+$'; returns FALSE SELECT 'one two th=E5ree' ~ '^[^ ]+[ ][^ ]+$'; returns FALSE SELECT 'one two thr=E5ee' ~ '^[^ ]+[ ][^ ]+$'; returns FALSE SELECT 'one two thre=E5e' ~ '^[^ ]+[ ][^ ]+$'; returns FALSE SELECT 'one two three=E5' ~ '^[^ ]+[ ][^ ]+$'; returns FALSE =20 Thank you for any response. =20 S=F8ren Vainio, Denmark ------_=_NextPart_001_01C1DFA3.C0227110 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
C= an someone=20 please explain the following?
I= am using a=20 regular expression to find strings containing two words (begin with on= e or=20 more characters not being spaces followed by a space followed by one or mor= e=20 characters not being spaces).
B= ut when=20 scandinavian characters are included it returns different results depending= on=20 where the character is positioned.
T= he first=20 two-word example returns TRUE as expected.
T= he second=20 three-word example returns FALSE as expected.
B= ut when I=20 let an =E5 (&#229 &aring a-ring) traverse through the string it=20 unexpectedly returns TRUE when the character is positioned as the second-la= st or=20 last character in the two first words.
 
S= ELECT 'one=20 two' ~ '^[^ ]+[ ][^ ]+$'; returns TRUE
SELECT 'one two three' ~ '^[^ ]+[= ][^=20 ]+$'; returns FALSE
SELECT '=E5one two three' ~ '^[^ ]+[ ][^ ]+$'; retur= ns=20 FALSE
SELECT 'o=E5ne two three' ~ '^[^ ]+[ ][^ ]+$'; returns FALSE
SE= LECT=20 'on=E5e two three' ~ '^[^ ]+[ ][^ ]+$'; returns TRUE
SELECT 'one=E5 two = three' ~=20 '^[^ ]+[ ][^ ]+$'; returns TRUE
SELECT 'one =E5two three' ~ '^[^ ]+[ ][^= ]+$';=20 returns FALSE
SELECT 'one t=E5wo three' ~ '^[^ ]+[ ][^ ]+$'; returns=20 FALSE
SELECT 'one tw=E5o three' ~ '^[^ ]+[ ][^ ]+$'; returns TRUE
SEL= ECT=20 'one two=E5 three' ~ '^[^ ]+[ ][^ ]+$'; returns TRUE
SELECT 'one two =E5= three' ~=20 '^[^ ]+[ ][^ ]+$'; returns FALSE
SELECT 'one two t=E5hree' ~ '^[^ ]+[ ][= ^ ]+$';=20 returns FALSE
SELECT 'one two th=E5ree' ~ '^[^ ]+[ ][^ ]+$'; returns=20 FALSE
SELECT 'one two thr=E5ee' ~ '^[^ ]+[ ][^ ]+$'; returns FALSE
SE= LECT=20 'one two thre=E5e' ~ '^[^ ]+[ ][^ ]+$'; returns FALSE
SELECT 'one two th= ree=E5' ~=20 '^[^ ]+[ ][^ ]+$'; returns FALSE
 
T= hank you=20 for any response.
 
S= =F8ren=20 Vainio, Denmark
------_=_NextPart_001_01C1DFA3.C0227110--