pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Emils Klotins <emils@mail.usis.bkc.lv>
To: Michal Samek <webmaster@tony.cz>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Select like when searching for whole word and optimizing it -- regexp?
Date: Thu, 10 Jun 1999 11:41:17 EET
Message-ID: <199906100837.LAA02976@omega.bkc.lv> (raw)
In-Reply-To: <375E289E.EF906BD2@tony.cz>

[9 Jun 99,, 10:41] Michal Samek wrote:

> In my e-shop I'm using the searching based on select like command;
> something like
> SELECT * FROM kat WHERE name LIKE '%some_text%';
> and when searching for the whole word:
> SELECT * FROM kat WHERE name LIKE '% some_text %';
> For this is necessary to maintain the name column with one space added
> before and after the name column value (to match starting and ending
> words). It's working but very ugly. 
> 
> Maybe there is some better way to search for the whole word? 
Try regexp searching. Don't know if available at 6.4, but definitely is there at 6.5
SELECT * FROM kat WHERE name ~* ' your regexp ';




Emils Klotins       e-mail: emils@mail.usis.bkc.lv
Systems Manager     URL: http://www.usis.bkc.lv/
USIS Riga           7 Smilsu Str., Riga LV1050, LATVIA




view thread (4+ messages)  latest in thread

Message-ID: <199906100837.LAA02976@omega.bkc.lv>
Permalink:  ../199906100837.LAA02976@omega.bkc.lv/
Also on:    postgresql.org/message-id/199906100837.LAA02976@omega.bkc.lv

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: emils@mail.usis.bkc.lv, webmaster@tony.cz
  Subject: Re: [SQL] Select like when searching for whole word and optimizing it -- regexp?
  In-Reply-To: <199906100837.LAA02976@omega.bkc.lv>
  References: <375E289E.EF906BD2@tony.cz> <199906100837.LAA02976@omega.bkc.lv>

* 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