Re: regexp_replace puzzle - Mailing list pgsql-general

From David W Noon
Subject Re: regexp_replace puzzle
Date
Msg-id 20100310165707.5ba9863c@dwnoon.ntlworld.com
Whole thread Raw
In response to regexp_replace puzzle  (Harald Fuchs <hari.fuchs@gmail.com>)
List pgsql-general
On Wed, 10 Mar 2010 13:41:54 +0100, Harald Fuchs wrote about [GENERAL]
regexp_replace puzzle:

[snip]
>  SELECT val,
>         regexp_replace(val,
>          '^(.*\W)?(C\d{7}|[DI]\d{6}|S\d{10})(\W.*)?$',
>          '\1' || '»\2«='|| sha224enc('\2') || '\3', 'i')
[snip]
>i.e. the first '\2' gets properly expanded by the second paren match,
>but the second '\2' doesn't get expanded.

The second instance of '\2' is first passed to sha224enc(), then that
function's result is passed to regexp_replace.
--
Regards,

Dave  [RLU #314465]
=======================================================================
david.w.noon@ntlworld.com (David W Noon)
=======================================================================

pgsql-general by date:

Previous
From: Ben Chobot
Date:
Subject: Re: log_statement and syslog severity
Next
From: Steve Crawford
Date:
Subject: Re: How to? Timestamp with timezone.