Lists: | pgsql-patches |
---|
From: | Atsushi Ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | regexp_replace |
Date: | 2005-06-27 13:14:44 |
Message-ID: | PIEMIKOOMKNIJLLLBCBBCEADCJAA.a_ogawa@hi-ho.ne.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
I made the patch that implements regexp_replace again.
The specification of this function is as follows.
regexp_replace(source text, pattern text, replacement text, [flags text])
returns text
Replace string that matches to regular expression in source text to
replacement text.
- pattern is regular expression pattern.
- replacement is replace string that can use '\1'-'\9', and '\&'.
'\1'-'\9': back reference to the n'th subexpression.
'\&' : entire matched string.
- flags can use the following values:
g: global (replace all)
i: ignore case
When the flags is not specified, case sensitive, replace the first
instance only.
regards,
--- Atsushi Ogawa
Attachment | Content-Type | Size |
---|---|---|
regexp_replace.patch | application/octet-stream | 20.3 KB |
From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Atsushi Ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: regexp_replace |
Date: | 2005-06-27 13:49:54 |
Message-ID: | 42C00402.8030409@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
I'm very glad to see this. But is a nicer name possible? To perl
programmers at least, "substitute" should make sense.
cheers
andrew
Atsushi Ogawa wrote:
>I made the patch that implements regexp_replace again.
>The specification of this function is as follows.
>
>regexp_replace(source text, pattern text, replacement text, [flags text])
>returns text
>
>Replace string that matches to regular expression in source text to
>replacement text.
>
> - pattern is regular expression pattern.
> - replacement is replace string that can use '\1'-'\9', and '\&'.
> '\1'-'\9': back reference to the n'th subexpression.
> '\&' : entire matched string.
> - flags can use the following values:
> g: global (replace all)
> i: ignore case
> When the flags is not specified, case sensitive, replace the first
> instance only.
>
>regards,
>
>--- Atsushi Ogawa
>
>
>------------------------------------------------------------------------
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>
>
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | Atsushi Ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: regexp_replace |
Date: | 2005-06-27 23:49:41 |
Message-ID: | 200506272349.j5RNnfR15216@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Andrew Dunstan wrote:
> I'm very glad to see this. But is a nicer name possible? To perl
> programmers at least, "substitute" should make sense.
What is the matter with replace? We already have replace:
test=> \df replace
List of functions
Schema | Name | Result data type | Argument data types
------------+---------+------------------+---------------------
pg_catalog | replace | text | text, text, text
test=> \df replace
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From: | Atsushi Ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: regexp_replace |
Date: | 2005-06-28 13:03:54 |
Message-ID: | PIEMIKOOMKNIJLLLBCBBEEBBCJAA.a_ogawa@hi-ho.ne.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Bruce Momjian wrote:
> Andrew Dunstan wrote:
> > I'm very glad to see this. But is a nicer name possible? To perl
> > programmers at least, "substitute" should make sense.
>
> What is the matter with replace? We already have replace:
>
> test=> \df replace
> List of functions
> Schema | Name | Result data type | Argument data types
> ------------+---------+------------------+---------------------
> pg_catalog | replace | text | text, text, text
>
I think that regexp_replace is a good name. It is easy to understand.
regards,
--- Atsushi Ogawa
From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Atsushi Ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp> |
Cc: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: regexp_replace |
Date: | 2005-06-28 13:26:07 |
Message-ID: | 42C14FEF.8050204@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Atsushi Ogawa wrote:
>
>I think that regexp_replace is a good name. It is easy to understand.
>
>
>
>
I'll go with the flow.
cheers
andrew
From: | Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz> |
---|---|
To: | Atsushi Ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp> |
Cc: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: regexp_replace |
Date: | 2005-06-28 13:42:08 |
Message-ID: | Pine.LNX.4.44.0506281541420.9650-100000@kix.fsv.cvut.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
> > pg_catalog | replace | text | text, text, text
> >
>
> I think that regexp_replace is a good name. It is easy to understand.
>
> regards,
I prefere this name too
Regards
Pavel Stehule
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Atsushi Ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: regexp_replace |
Date: | 2005-07-10 04:56:03 |
Message-ID: | 200507100456.j6A4u3r08884@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
I have applied your patch, with slight adjustments in spacing and
documentation.
Patch applied. Thanks.
---------------------------------------------------------------------------
Atsushi Ogawa wrote:
>
> I made the patch that implements regexp_replace again.
> The specification of this function is as follows.
>
> regexp_replace(source text, pattern text, replacement text, [flags text])
> returns text
>
> Replace string that matches to regular expression in source text to
> replacement text.
>
> - pattern is regular expression pattern.
> - replacement is replace string that can use '\1'-'\9', and '\&'.
> '\1'-'\9': back reference to the n'th subexpression.
> '\&' : entire matched string.
> - flags can use the following values:
> g: global (replace all)
> i: ignore case
> When the flags is not specified, case sensitive, replace the first
> instance only.
>
> regards,
>
> --- Atsushi Ogawa
[ Attachment, skipping... ]
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 23.3 KB |
From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | Atsushi Ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: regexp_replace |
Date: | 2005-07-10 16:49:38 |
Message-ID: | 42D151A2.1030309@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
The change below has broken tsearch2. See for example
http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=shrew&dt=2005-07-10%2015:02:01
cheers
andrew
Bruce Momjian wrote:
>I have applied your patch, with slight adjustments in spacing and
>documentation.
>
>Patch applied. Thanks.
>
>
>
[snip]
>Index: src/include/regex/regex.h
>===================================================================
>RCS file: /cvsroot/pgsql/src/include/regex/regex.h,v
>retrieving revision 1.26
>diff -c -c -r1.26 regex.h
>*** src/include/regex/regex.h 29 Nov 2003 22:41:10 -0000 1.26
>--- src/include/regex/regex.h 10 Jul 2005 04:52:51 -0000
>***************
>*** 163,169 ****
> * the prototypes for exported functions
> */
> extern int pg_regcomp(regex_t *, const pg_wchar *, size_t, int);
>! extern int pg_regexec(regex_t *, const pg_wchar *, size_t, rm_detail_t *, size_t, regmatch_t[], int);
> extern void pg_regfree(regex_t *);
> extern size_t pg_regerror(int, const regex_t *, char *, size_t);
>
>--- 163,169 ----
> * the prototypes for exported functions
> */
> extern int pg_regcomp(regex_t *, const pg_wchar *, size_t, int);
>! extern int pg_regexec(regex_t *, const pg_wchar *, size_t, size_t, rm_detail_t *, size_t, regmatch_t[], int);
> extern void pg_regfree(regex_t *);
> extern size_t pg_regerror(int, const regex_t *, char *, size_t);
>
>
>
>
From: | Atsushi Ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: regexp_replace |
Date: | 2005-07-11 15:29:05 |
Message-ID: | PIEMIKOOMKNIJLLLBCBBEEOACJAA.a_ogawa@hi-ho.ne.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Bruce Momjian wrote:
> I have applied your patch, with slight adjustments in spacing and
> documentation.
>
> Patch applied. Thanks.
Thank you for applying patch.
An attached patch is a small additional improvement.
This patch use appendStringInfoText instead of appendStringInfoString.
There is an overhead of PG_TEXT_GET_STR when appendStringInfoString is
executed by text type. This can be reduced by appendStringInfoText.
regards,
Atsushi Ogawa
Attachment | Content-Type | Size |
---|---|---|
varlena.patch | application/octet-stream | 2.6 KB |
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Atsushi Ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: regexp_replace |
Date: | 2005-07-29 03:17:40 |
Message-ID: | 200507290317.j6T3Hef28515@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Patch applied. Thanks.
---------------------------------------------------------------------------
Atsushi Ogawa wrote:
>
> Bruce Momjian wrote:
> > I have applied your patch, with slight adjustments in spacing and
> > documentation.
> >
> > Patch applied. Thanks.
>
> Thank you for applying patch.
> An attached patch is a small additional improvement.
>
> This patch use appendStringInfoText instead of appendStringInfoString.
> There is an overhead of PG_TEXT_GET_STR when appendStringInfoString is
> executed by text type. This can be reduced by appendStringInfoText.
>
> regards,
>
> Atsushi Ogawa
[ Attachment, skipping... ]
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073