Re: regexp idea

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: AI Rumman <rummandba(at)gmail(dot)com>
Cc: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: regexp idea
Date: 2013-08-27 20:07:18
Message-ID: 521D06F6.9030808@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 08/27/2013 02:04 PM, AI Rumman wrote:
> 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(at)gmail(dot)com
> <mailto:robjsargent(at)gmail(dot)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(at)postgresql(dot)org
> <mailto:pgsql-general(at)postgresql(dot)org>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
>
http://www.postgresql.org/docs/9.1/static/functions-matching.html is the
best starting point

In response to

Browse pgsql-general by date

  From Date Subject
Next Message pg noob 2013-08-27 21:26:09 postgres 9.2
Previous Message AI Rumman 2013-08-27 20:04:08 Re: regexp idea