From: | "Nick Barr" <nick(dot)barr(at)webbased(dot)co(dot)uk> |
---|---|
To: | <csegyud(at)vnet(dot)hu>, <terry(at)ashtonwoodshomes(dot)com>, "'Pgsql-General(at)Postgresql(dot)Org (E-mail)'" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Using regular expressions in LIKE |
Date: | 2004-01-14 13:46:16 |
Message-ID: | 8F4A22E017460A458DB7BBAB65CA6AE502AA43@openmanage |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> > > -----Original Message-----
> > > From: pgsql-general-owner(at)postgresql(dot)org
> > > [mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Együd
Csaba
> > > Sent: Wednesday, January 14, 2004 6:43 AM
> > > To: Pgsql-General(at)Postgresql(dot)Org (E-mail)
> > > Subject: [GENERAL] Using regular expressions in LIKE
> > >
> > >
> > > Hi All,
> > > I'd like to "compress" the following two filter expressions
> > into one -
> > > assuming that it makes sense regarding query execution
performance.
> > >
> > > ... where (adate LIKE "2004.01.10 __:30" or adate LIKE
> > > "2004.01.10 __:15")
> > > ...
> > >
> > > into something like this:
> > >
> > > ... where adate LIKE "2004.01.10 __:(30/15)" ...
> > >
> > > which means that I need only those rows which has an "adate"
> > > field holding
> > > dates on 2004.01.10 every 30 or 15 minutes at the end. Is it
> > > possible to use
> > > some regular expressions or is it worth at all talking about?
> > >
> > > thanks,
> > > -- Csaba
> > >
How about:
where adate ~ '^2004-01-10 ([0-9]{2}):(15|30)'
There may be a more concise version but this seems to work. Please say
if you want a description of exactly what the string means.
Kind Regards,
Nick Barr
WebBased Ltd.
Tel: (01752) 764445
Fax: (01752) 764446
Email: nick(dot)barr(at)webbased(dot)co(dot)uk
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender. You
should not copy it or use it for any purpose nor disclose or distribute
its contents to any other person.
From | Date | Subject | |
---|---|---|---|
Next Message | Shridhar Daithankar | 2004-01-14 13:50:33 | Re: Huge Data |
Previous Message | Sezai YILMAZ | 2004-01-14 13:45:05 | Re: Huge Data |