Received: from loif.w3ping.net (217-126-142-208.uc.nombres.ttd.es [217.126.142.208]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fBI9ZNm58874 for ; Tue, 18 Dec 2001 04:35:23 -0500 (EST) (envelope-from fiol@w3ping.com) Received: from localhost ([127.0.0.1] helo=w3ping.com) by loif.w3ping.net with esmtp (Exim 3.33 #1 (Debian)) id 16GGeV-0004F4-00; Tue, 18 Dec 2001 10:35:11 +0100 Message-ID: <3C1F0DCB.20805@w3ping.com> Date: Tue, 18 Dec 2001 10:35:07 +0100 From: Antonio Fiol =?ISO-8859-1?Q?Bonn=EDn?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.6) Gecko/20011202 X-Accept-Language: es-ES, es, en, fr MIME-Version: 1.0 To: joe@jwebmedia.com CC: pgsql-general@postgresql.org Subject: Re: Query Help References: <20011217162919.74067.qmail@web14707.mail.yahoo.com> <3C1E5695.98B1EC4F@jwebmedia.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200112/639 X-Sequence-Number: 18734 For your very particular purpose, you may try to use ---------------- select * from table where substring(column, 0,1) between '0' and '9'; ---------------- For a more general purpose, try the ~ operator. \do will give you a list of available operators You should maybe care about ~* operator also (case insensitive). If you need to match one among many regular expressions, you can try to store them in a little table, and then try: ---------------- select distinct table.* from table, regex_table where table.column ~ regex_table.regex; ---------------- DISTINCT is there to avoid that entries matching multiple regexps appear multiple times. No guarantees on performance. HTH, Antonio Joe Koenig wrote: >Thanks for the responses - I was able to patch something together from >the responses. On to the next thing - I want to do a search based on a >reg ex. Does PostgreSQL have something like MySQL's "RLIKE"? I want to >pull all records in a category that start with a number 0-9. The best >way I saw was to do a UNION with all the numbers, but I figured there >was a better way. Thanks, > >Joe >