repeated characters in SQL

Поиск
Список
Период
Сортировка
От Govind Chettiar
Тема repeated characters in SQL
Дата
Msg-id CAFH6Zn+eu7LnmRcobcRS-5OoEPMjrDGqNTW08z-k81AfNQStdw@mail.gmail.com
обсуждение исходный текст
Ответы Re: repeated characters in SQL  (David Rowley <david.rowley@2ndquadrant.com>)
Список pgsql-general
I have a simple table consisting of a bunch of English words.  I am trying to find words that have repeated characters in them, for example
apple
tattoo

but not

orange 
lemon

I know that only a maximum of one repetition can occur

I tried various options like
SELECT word FROM  public."SpellItWords" 
 WHERE word ~ E'(.)\1{2,}'

SELECT word FROM  public."SpellItWords" 
 WHERE word ~ E'([a-z])\1{2}'

What finally worked was this
SELECT word FROM  public."SpellItWords" 
 WHERE word ~ E'(.)\\1'

But I don't really understand what this does...Can you explain?

Thanks!

В списке pgsql-general по дате отправления:

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Let's Do the CoC Right
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: A motion