Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id C260B9FB471 for ; Fri, 20 Jul 2007 16:20:33 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 47777-03 for ; Fri, 20 Jul 2007 16:20:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail.mediamatters.org (mail.mediamatters.org [63.240.197.71]) by postgresql.org (Postfix) with ESMTP id 0ED769FA0CC for ; Fri, 20 Jul 2007 16:20:29 -0300 (ADT) Received: from [10.1.0.133] (63-146-242-133.dia.static.qwest.net [63.146.242.133]) by mail.mediamatters.org (Postfix) with ESMTP id 28FAB96C1AE for ; Fri, 20 Jul 2007 15:20:03 -0400 (EDT) Message-ID: <46A10AB1.8040103@mediamatters.org> Date: Fri, 20 Jul 2007 15:19:13 -0400 From: Jon Sime Organization: Media Matters for America User-Agent: Thunderbird 2.0.0.4 (X11/20070615) MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: select a range of data References: <497741.11791.qm@web56410.mail.re3.yahoo.com> In-Reply-To: <497741.11791.qm@web56410.mail.re3.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/236 X-Sequence-Number: 26217 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/