Re: Regex with patterns in table field

From: "pgdb" <pgdb(at)gawab(dot)com>
To: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Regex with patterns in table field
Date: 2006-04-14 03:02:52
Message-ID: 20060414030252.10624.qmail@gawab.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


<HTML><DIV class=bgcolor STYLE="background-color: ;"><DIV>
<DIV>Hi Andreas,</DIV>
<DIV>&nbsp;</DIV>
<DIV>strange but I don't see html from my original email
received from the mailing list, hope this reply is ok:)</DIV>
<DIV>&nbsp;</DIV>
<DIV>If I'm not wrong, the example you've provided is trying to
return matching rows&nbsp;from multiple patterns and texts as
inputs in the regex search.</DIV>
<DIV>&nbsp;</DIV>
<DIV>The text in regular expression have to be just a single
string(with no white character) for my case. Matching should
then be done with patterns from each row, returning the row(s)
that contain matching regex pattern(s). Appreciate any advice.
Thanks.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Regards</DIV>
<DIV>pgdb</DIV>
<DIV>&nbsp;</DIV>
<DIV>A. Kretschmer writes: </DIV>
<DIV></DIV>
<DIV>&gt; am 13.04.2006, um 12:47:38 +0000 mailte pgdb
folgendes: </DIV>
<DIV>&gt;&gt; </DIV>
<DIV>&gt;&gt;
<DIV class=bgcolor>
<DIV></DIV>
<DIV>&gt;&gt;
<DIV></DIV>
<DIV>&gt;&gt;
<DIV></DIV>
<DIV>&gt;&gt;
<DIV>Hi,</DIV></DIV>
<DIV>&gt;&gt;
<DIV>&nbsp;</DIV></DIV>
<DIV>&gt;&gt;
<DIV>like to know how, if possible, for patterns </DIV>
<DIV>&gt;&gt; as&nbsp;attribute in a table to be used in a regex
search with a </DIV>
<DIV>&gt;&gt; fixed string. The query should therefore return
the rows that </DIV>
<DIV>&gt;&gt; have matching patterns with the single
text.</DIV></DIV>
<DIV>&gt; </DIV>
<DIV>&gt; It's hard to read such text, please use plain ASCII
insteed HTML. </DIV>
<DIV>&gt; </DIV>
<DIV>&gt; Perhaps you are looking for something like this:
</DIV>
<DIV>&gt; </DIV>
<DIV>&gt; test=# select * from search; </DIV>
<DIV>&gt; text </DIV>
<DIV>&gt; ---------------- </DIV>
<DIV>&gt; this is a test </DIV>
<DIV>&gt; (1 row) </DIV>
<DIV>&gt; </DIV>
<DIV>&gt; test=# select * from pattern; </DIV>
<DIV>&gt; text </DIV>
<DIV>&gt; --------- </DIV>
<DIV>&gt; ^this.* </DIV>
<DIV>&gt; ^foo </DIV>
<DIV>&gt; (2 rows) </DIV>
<DIV>&gt; </DIV>
<DIV>&gt; test=# select pattern.text, search.text from pattern,
search where search.text ~ pattern.text; </DIV>
<DIV>&gt; text | text </DIV>
<DIV>&gt; ---------+---------------- </DIV>
<DIV>&gt; ^this.* | this is a test </DIV>
<DIV>&gt; (1 row) </DIV>
<DIV>&gt; </DIV>
<DIV>&gt; </DIV>
<DIV>&gt; </DIV>
<DIV>&gt; HTH, Andreas </DIV>
<DIV>&gt; -- </DIV>
<DIV>&gt; Andreas Kretschmer (Kontakt: siehe Header) </DIV>
<DIV>&gt; Heynitz: 035242/47215, D1: 0160/7141639 </DIV>
<DIV>&gt; GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net </DIV>
<DIV>&gt; === Schollglas Unternehmensgruppe === </DIV>
<DIV>&gt; </DIV>
<DIV>&gt; ---------------------------(end of
broadcast)--------------------------- </DIV>
<DIV>&gt; TIP 3: Have you checked our extensive FAQ? </DIV>
<DIV>&gt; </DIV>
<DIV>&gt; http://www.postgresql.org/docs/faq </DIV>
<DIV></DIV>
<DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></HTML>
<DIV>________________________________</DIV>
<DIV>Free POP3 Email from <a href="http://www.gawab.com"
target="_blank">www.gawab.com</a></DIV>
<DIV>Sign up NOW and get your account @gawab.com!!</DIV>

Attachment Content-Type Size
unknown_filename text/html 3.0 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mavinakuli, Prasanna (STSD) 2006-04-14 03:43:26 HUGE Stack space is gettiing consumed
Previous Message Ron Mayer 2006-04-13 21:12:03 Re: Off-Topic: DBMS Market Research