Skip site navigation (1) Skip section navigation (2)

Re: Regexp match with accented character problem

From: Thom Brown <thombrown(at)gmail(dot)com>
To: Laslo Forro <getforum(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Regexp match with accented character problem
Date: 2010-06-08 09:45:48
Message-ID: AANLkTimffIO-tpKeXP2Zrs8TJmT15bb2xNsgzjZxYoOb@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
On 8 June 2010 09:48, Laslo Forro <getforum(at)gmail(dot)com> wrote:
> Hi there, could someone drop me a hint on the whys at below?
> The table:
> test=# select * from texts;
>     title     |         a_text
> --------------+-------------------------
>  A macskacicó | A blah blah macskacicónak.
> The dark tower | Blah blah
> (2 rows)
> Now, I want to match 'macskacicó' WORD.
> It works:
> test=# select * from texts where title ~* E'macskacicó';
>     title     |         a_text
> --------------+-------------------------
>  A macskacicó | A blah blah macskacicó.
> (1 row)
> But it would also macth 'macskacicónak' string:
> test=# select * from texts where a_text ~* E'macskacicó';
>     title     |           a_text
> --------------+----------------------------
>  A macskacicó | A blah blah macskacicónak.
> (1 row)
> Now, these do not work:
> test=# select * from texts where title ~* E'\\mmacskacicó\\M';

That works for me.

> test=# select * from texts where title ~* E'\\<macskacicó\\>';

What's that supposed to be doing?

> test=# select * from texts where title ~* E'\\Wmacskacicó\\W';

That shouldn't work because nothing follows that word.  You'd need to
match like this in that case:

select * from texts where title ~* E'\\Wmacskacicó$';

If you add something like a space or full-stop (period) after that
word, it will match.

Accented characters should match against \\w

To prove it, try:

select * from texts where title ~* E'\\Wmacskacic\\w';

Regards

Thom

In response to

Responses

pgsql-novice by date

Next:From: Laslo ForroDate: 2010-06-08 09:57:35
Subject: Re: Regexp match with accented character problem
Previous:From: Laslo ForroDate: 2010-06-08 08:48:53
Subject: Regexp match with accented character problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group