Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 47EA39FB314 for ; Tue, 27 Mar 2007 16:44:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 21131-09 for ; Tue, 27 Mar 2007 16:44:14 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from correio2.docasdoporto.com.br (22.144.199.200.docasdoporto.com.br [200.199.144.22]) by postgresql.org (Postfix) with ESMTP id 0D2FA9FA282 for ; Tue, 27 Mar 2007 16:44:08 -0300 (ADT) Received: from [201.32.161.79] (account ezequias@fastcon.com.br) by correio2.docasdoporto.com.br (CommuniGate Pro WebUser 4.1.8) with HTTP id 47508192; Tue, 27 Mar 2007 17:01:50 -0300 From: Subject: Re: Regular Expressions To: Guy Fraser , pgsql-sql@postgresql.org X-Mailer: CommuniGate Pro WebUser Interface v.4.1.8 Date: Tue, 27 Mar 2007 17:01:50 -0300 Message-ID: In-Reply-To: <1174509146.26600.39.camel@sigurd.incentre.net> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format="flowed" Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.571 tagged_above=0 required=5 tests=AWL, BAYES_20, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200703/323 X-Sequence-Number: 27961 Guy, Could you give me a hand ? I have a ZipCode table and my address table I just would like to find out all matches that my zipcode table has where my address table appears like this: Elmo Street, 30 I would like my SQL find out all matches we can find 'Elmo', 'Street'. The commas, spaces and numbers could be forgive. I hope you could help me Regards Ezequias Em Wed, 21 Mar 2007 14:32:26 -0600 Guy Fraser escreveu: >On Wed, 2007-03-21 at 14:37 -0300, Ezequias R. da Rocha wrote: >> Guy Fraser escreveu: >> > On Wed, 2007-03-21 at 11:04 -0300, Ezequias R. da Rocha wrote: >> > >> >> Hi list, >> >> >> >> I would like to know if postgresql has a Regular Expressions (Regex) >> >> implemented already. >> >> >> >> With it we could implement queries like >> >> >> >> Select * from myClientes where name = 'E[zs]equias' >> >> >> >> >> > Case Sensitive Regular Match ~ >> > Case Insensitive Regular Match ~* >> > Negated Case Sensitive Regular Match !~ >> > Negated Case Insensitive Regular Match !~* >> > >> > Select * from myClientes where name ~ 'E[zs]equias' >> > >> > >> >> where the result occurs even if the field has Ezequias or Esequias. >> >> >> >> Regards >> >> Ezequias >> >> >> >> ---------------------------(end of broadcast)--------------------------- >> >> TIP 2: Don't 'kill -9' the postmaster >> >> >> >> >> Great I am thinking of putting my like to rest. I felt it faster than >> "like" statement, have you any information about that ? >> > >No I don't know if regular expressions are faster than "LIKE" but >I think they are more flexible. When developing queries, I usually >try different methods of matching to find out what works best for >each circumstance. Some times upper() lower() and substr() with an >"=" are more effective than other methods. > >One of the more powerful features of PostgreSQL is the ability to >use sub-selects to reduce the time required to process a subset of >data from a larger volume of data. > >Example : > >select > * >from ( > select > ss_time, > ss_date, > ss_type, > ss_data > from > full_set > where > ss_type in ('type_a','type_x') > ) as sub_set >where > upper(ss_data) ~ '[A-Z][0-9][A-Z] ?[0-9][A-Z][0-9]' >order by > ss_time, > ss_date, > ss_type >; > > >> Ezequias >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 7: You can help support the PostgreSQL project by donating at >> >> http://www.postgresql.org/about/donate >> > > >---------------------------(end of broadcast)--------------------------- >TIP 7: You can help support the PostgreSQL project by donating at > > http://www.postgresql.org/about/donate -- Ezequias Rodrigues da Rocha