Re: Regex with patterns in table field

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Regex with patterns in table field
Date: 2006-04-13 13:11:14
Message-ID: 20060413131114.GH28340@webserv.wug-glas.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

am 13.04.2006, um 12:47:38 +0000 mailte pgdb folgendes:
>
> <HTML><DIV class=bgcolor STYLE="background-color: ;"><DIV>
> <DIV>
> <DIV>
> <DIV>Hi,</DIV>
> <DIV>&nbsp;</DIV>
> <DIV>like to know how, if possible, for patterns
> as&nbsp;attribute in a table to be used in a regex search with a
> fixed string. The query should therefore return the rows that
> have matching patterns with the single text.</DIV>

It's hard to read such text, please use plain ASCII insteed HTML.

Perhaps you are looking for something like this:

test=# select * from search;
text
----------------
this is a test
(1 row)

test=# select * from pattern;
text
---------
^this.*
^foo
(2 rows)

test=# select pattern.text, search.text from pattern, search where search.text ~ pattern.text;
text | text
---------+----------------
^this.* | this is a test
(1 row)

HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47215, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Zahir Lalani 2006-04-13 13:27:44 the integer type
Previous Message Dave Page 2006-04-13 13:10:44 Re: How to compile PostGreSQL on Windows 64 bits ?