Re: regexp idea

Поиск
Список
Период
Сортировка
От AI Rumman
Тема Re: regexp idea
Дата
Msg-id CAGoODpfMo6i0j6WGD-4ZhD1rHy7qD6oJbLUWVxJpUcDoOcV9cQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: regexp idea  (Rob Sargent <robjsargent@gmail.com>)
Ответы Re: regexp idea  (Rob Sargent <robjsargent@gmail.com>)
Re: regexp idea  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-general
Thanks. That's awesome.
Do you have any good guide where I may get more knowledge on REGEXP?


On Tue, Aug 27, 2013 at 3:57 PM, Rob Sargent <robjsargent@gmail.com> wrote:
On 08/27/2013 12:44 PM, AI Rumman wrote:
Hi,

I have a string like:
Gloucester Catholic vs. St. Augustine baseball, South Jersey Non-Public A final, June 5, 2013

I need to extract date part from the string.

I used the follows:
regexp_matches(title,'[.* ]+\ (Jul|August|Sep)[, a-zA-Z0-9]+' )

But it gives me result August as it stops at "Augustine".

In my case, date can be in different formats, some record may use "," or some may not.

Any idea to achieve this?

Thanks.
select regexp_replace('Gloucester Catholic vs. St. Augustine baseball, South Jersey Non-Public A final, June 5, 2013', E'(^.*)(\\m(June|July|August|Sep))([, a-zA-Z0-9]+)', E'\\2 \\4' );
+----------------+
| regexp_replace |
+----------------+
| June  5, 2013  |
+----------------+
(1 row)




--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

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

Предыдущее
От: Rob Sargent
Дата:
Сообщение: Re: regexp idea
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: regexp idea