pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jon Sime <jsime@mediamatters.org>
To: pgsql-admin@postgresql.org
Subject: Re: select a range of data
Date: Fri, 20 Jul 2007 15:19:13 -0400
Message-ID: <46A10AB1.8040103@mediamatters.org> (raw)
In-Reply-To: <497741.11791.qm@web56410.mail.re3.yahoo.com>
References: <497741.11791.qm@web56410.mail.re3.yahoo.com>

Jessica Richard wrote:
> If I have a column with a value like "abc2457", "efg1234",
> 
> how do I select col from table where col like 'a[a-z]c24[0-9]7"?
> 
> How do I handle the range bracket in the query?

You can use the regular expression operator(s), like so:

     select *
     from table
     where column ~ 'a[a-z]c24[0-9]7';

For the full details: 
http://www.postgresql.org/docs/8.2/interactive/functions-matching.html#AEN9312

-Jon

-- 
Senior Systems Developer
Media Matters for America
http://mediamatters.org/



view thread (3+ messages)  latest in thread

Message-ID: <46A10AB1.8040103@mediamatters.org>
Permalink:  ../46A10AB1.8040103@mediamatters.org/
Also on:    postgresql.org/message-id/46A10AB1.8040103@mediamatters.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: jsime@mediamatters.org
  Subject: Re: select a range of data
  In-Reply-To: <46A10AB1.8040103@mediamatters.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox