Re: Regexp match with accented character problem
От | Laslo Forro |
---|---|
Тема | Re: Regexp match with accented character problem |
Дата | |
Msg-id | AANLkTikB2GnPuPycu1S_QR5524mGHC2rYUVCRFJKblKP@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Regexp match with accented character problem (Thom Brown <thombrown@gmail.com>) |
Ответы |
Re: Regexp match with accented character problem
|
Список | pgsql-novice |
Thanx for your response!
You write:
>test=# select * from texts where title ~* E'\\mmacskacicó\\M';
>
>That works for me.
However, it doesn't work for me (if I understand you right):
test=# select * from texts where title ~* E'\\mmacskacicó\\M';
title | a_text
-------+--------
(0 rows)
It does:
test=# select * from texts where title ~* E'\\mmacskacicó$';
title | a_text
--------------+----------------------------
A macskacicó | A blah blah macskacicónak.
(1 row)
On Tue, Jun 8, 2010 at 11:45 AM, Thom Brown <thombrown@gmail.com> wrote:
On 8 June 2010 09:48, Laslo Forro <getforum@gmail.com> wrote:That works for me.
> 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';
> test=# select * from texts where title ~* E'\\<macskacicó\\>';
What's that supposed to be doing?That shouldn't work because nothing follows that word. You'd need to
> test=# select * from texts where title ~* E'\\Wmacskacicó\\W';
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
В списке pgsql-novice по дате отправления: