pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedPattern Matchig
3+ messages / 2 participants
[nested] [flat]
* Pattern Matchig
@ 2008-04-08 17:14 Tk421 <vrobador@gmail.com>
2008-04-08 17:24 ` Re: Pattern Matchig Alvaro Herrera <alvherre@commandprompt.com>
0 siblings, 1 reply; 3+ messages in thread
From: Tk421 @ 2008-04-08 17:14 UTC (permalink / raw)
To: pgsql-sql
Hello everybody
I'm trying to make a query in a table to find the records who
contains a full word 'im looking for.
Here is an example about i'm trying
code text
1 foobar
2 xxxx foobar
3 xxxx foobar yyyyy
4 foobar xxxx
5 foobars
6 foobar.
7 xxxx foobar.
What i want is to find foobar (records 1, 2, 3 and 4) but no foobars
(record 5). If i try
SELECT code FROM table WHERE text LIKE '%foobar%'
The result is 1, 2, 3, 4, 5, 6, 7. But if I try
SELECT code FROM table WHERE text LIKE '% foobar %'
The result is only record number 3. How can i search the entire
FOOBAR word? The result wanted must be all, excepting 5.
Thank you very much.
PD: Sorry about my english
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Pattern Matchig
2008-04-08 17:14 Pattern Matchig Tk421 <vrobador@gmail.com>
@ 2008-04-08 17:24 ` Alvaro Herrera <alvherre@commandprompt.com>
2008-04-08 17:39 ` Re: Pattern Matchig Tk421 <vrobador@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Alvaro Herrera @ 2008-04-08 17:24 UTC (permalink / raw)
To: Tk421 <vrobador@gmail.com>; +Cc: pgsql-sql
Tk421 escribió:
> The result is only record number 3. How can i search the entire
> FOOBAR word? The result wanted must be all, excepting 5.
Something like this:
select code from table where text ~ '[[:<:]]foobar[[:>:]]'
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Pattern Matchig
2008-04-08 17:14 Pattern Matchig Tk421 <vrobador@gmail.com>
2008-04-08 17:24 ` Re: Pattern Matchig Alvaro Herrera <alvherre@commandprompt.com>
@ 2008-04-08 17:39 ` Tk421 <vrobador@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: Tk421 @ 2008-04-08 17:39 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@commandprompt.com>; +Cc: pgsql-sql
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Alvaro Herrera escribió:
<blockquote cite="mid:20080408172409.GJ9062@alvh.no-ip.org" type="cite">
<pre wrap="">Tk421 escribió:
</pre>
<blockquote type="cite">
<pre wrap=""> The result is only record number 3. How can i search the entire
FOOBAR word? The result wanted must be all, excepting 5.
</pre>
</blockquote>
<pre wrap=""><!---->
Something like this:
select code from table where text ~ '[[:<:]]foobar[[:>:]]'
</pre>
</blockquote>
Thank you very much, it worked!<br>
<br>
Gracias, Álvaro<br>
</body>
</html>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2008-04-08 17:39 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-04-08 17:14 Pattern Matchig Tk421 <vrobador@gmail.com>
2008-04-08 17:24 ` Alvaro Herrera <alvherre@commandprompt.com>
2008-04-08 17:39 ` Tk421 <vrobador@gmail.com>
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