regex help wanted - Mailing list pgsql-general

From Karsten Hilbert
Subject regex help wanted
Date
Msg-id 20130425141127.GH3802@hermes.hilbert.loc
Whole thread Raw
Responses Re: regex help wanted
List pgsql-general
Hi,

I am in the process of converting some TEXT data which I try
to identify by regular expression.

What I don't understand is: Why does the following return a
substring ?

    select substring ('junk $<allergy::test::99>$ junk' from '\$<[^<]+?::[^:]+?>\$');

I would have thought the '::[^:]+?>' part should have meant

    after two ":"s
    match at least one character
    except any further ":"s
    until the next ">"

I don't find the flaw in my thinking. Can anyone help ?

(Sure, it is not PostgreSQL-specific yet I need to run this
in PostgreSQL on data migration.)

Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: pgdump error "Could not open file pg_clog/0B8E: No such file or directory"
Next
From: Andres Freund
Date:
Subject: Re: Replication terminated due to PANIC