Re: regexp_matches problem

From: "WP Perquin" <perquin(at)yuplounge(dot)nl>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: regexp_matches problem
Date: 2009-05-12 19:01:09
Message-ID: 8DF8DA6CE0E4405F8C20B3AA5E0F1E4D@yuploung008f4f
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

When I make the following simplified example:

SELECT regexp_matches('<img src="wwww" title="dit is een title tekst"
class="class12">'

,'((title\s*=\s*\"([^"]*)")+)|((src\s*=\s*\"([^"]*)")+)','ig')

My result are 2 rows:

"{NULL,NULL,NULL,"src=\"wwww\"","src=\"wwww\"",wwww}"

"{"title=\"dit is een title tekst\"","title=\"dit is een title tekst\"","dit
is een title tekst",NULL,NULL,NULL}"

I would like to have 1 row which contains both the records. Does anyone know
how I can solve this?

Willem

_____

Van: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] Namens WP Perquin
Verzonden: dinsdag 12 mei 2009 13:44
Aan: pgsql-general(at)postgresql(dot)org
Onderwerp: [GENERAL] regexp_matches problem

(postgresql 8.3.7, linux centos)

I made the following regexp_matches

SELECT regexp_matches(
(
SELECT content
FROM page
WHERE idpage = 2
)
,','<img\\s+((title="[^"]+")|(alt="[^"]+")|([^>]))*>'
, 'ig'
) AS result

The result looks like: {"\"",NULL,NULL,"\""} in phpPgAdmin.

Which is not the right result. I want to see als the images and their alt,
title and src.

Can anyone help with telling what I am doing wrong?

Willem

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2009-05-12 19:03:14 Re: Could not open file "pg_clog/...."
Previous Message Alvaro Herrera 2009-05-12 18:51:44 Re: Could not open file "pg_clog/...."