Thank you!
2016-08-15 18:36 GMT+05:00, hubert depesz lubaczewski :
> On Mon, Aug 15, 2016 at 06:27:06PM +0500, Михаил wrote:
>> I need to escape double quotes only:
>> test=# select regexp_replace('"""{Performer,"Boomwacker ""a""
>> Recording""}"""', '([^"])"{2}([^"])', '\1\"\2', 'g');
>>
On Mon, Aug 15, 2016 at 9:27 AM, Михаил wrote:
> Hi!
>
> I need to escape double quotes only:
> test=# select regexp_replace('"""{Performer,"Boomwacker ""a""
> Recording""}"""', '([^"])"{2}([^"])', '\1\"\2', 'g');
> regexp_replace
> ---
On Mon, Aug 15, 2016 at 06:27:06PM +0500, Михаил wrote:
> I need to escape double quotes only:
> test=# select regexp_replace('"""{Performer,"Boomwacker ""a""
> Recording""}"""', '([^"])"{2}([^"])', '\1\"\2', 'g');
> regexp_replace
> ---
Hi!
I need to escape double quotes only:
test=# select regexp_replace('"""{Performer,"Boomwacker ""a""
Recording""}"""', '([^"])"{2}([^"])', '\1\"\2', 'g');
regexp_replace
-
"""{Performer,"Boomwacker \"a"" Recording\"}"""
This is u
On Thu, Jan 14, 2016 at 1:27 PM, Andy Colson wrote:
> On 1/14/2016 2:06 PM, David G. Johnston wrote:
>
>> select regexp_replace('71.09.6.01.3', '(\d)[.-](?=\d)', '\1\2', 'g');
>>
>
John already picked up on the fact that the "\2" in the replacement is
pointless (neither helping nor hurting) sin
On 1/14/2016 2:06 PM, David G. Johnston wrote:
select regexp_replace('71.09.6.01.3', '(\d)[.-](?=\d)', '\1\2', 'g');
Thanks David!
-Andy
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-genera
On 1/14/2016 2:02 PM, John McKown wrote:
How about:
select regexp_replace('71.09.6.01.3', '(\d)[.-]', '\1', 'g');
match is 1.3 and result is 13 ( 71096.013). If you don't want to
eliminate the period or dash unless it is _between_ two digits, try:
select regexp_replace('71.09.6.01.3', '(\d)[.-
On Thu, Jan 14, 2016 at 12:43 PM, Andy Colson wrote:
> Hi all.
>
> This is not doing as I'd expected:
>
> select regexp_replace('71.09.6.01.3', '(\d)[.-](\d)', '\1\2', 'g');
>
> regexp_replace
>
> 71096.013
> (1 row)
>
>
Solution: select regexp_replace('71.09.6.01.3', '(\d)[.-
On 1/14/2016 1:59 PM, Tom Lane wrote:
Andy Colson writes:
This is not doing as I'd expected:
select regexp_replace('71.09.6.01.3', '(\d)[.-](\d)', '\1\2', 'g');
regexp_replace
71096.013
(1 row)
I think regexp_replace considers only non-overlapping substrings,
eg,
How about:
select regexp_replace('71.09.6.01.3', '(\d)[.-]', '\1', 'g');
?
In your example, the (\d)[.-](\d) says find a digit followed by a period or
dash followed by another digit. The first time through 1.0 is matched and
replaced with 10 (710) with the "current location" pointing before the
Andy Colson writes:
> This is not doing as I'd expected:
> select regexp_replace('71.09.6.01.3', '(\d)[.-](\d)', '\1\2', 'g');
> regexp_replace
>
> 71096.013
> (1 row)
I think regexp_replace considers only non-overlapping substrings,
eg, once it's replaced 1.0 with 10, it t
Hi all.
This is not doing as I'd expected:
select regexp_replace('71.09.6.01.3', '(\d)[.-](\d)', '\1\2', 'g');
regexp_replace
71096.013
(1 row)
It acts the same with dashes:
select regexp_replace('71-09-6-01-3', '(\d)[.-](\d)', '\1\2', 'g');
regexp_replace
On 10 December 2015 at 10:56, Christopher Molnar
wrote:
> Hello,
>
> I am running into a problem and need some pointers on regexp_replace - I
> can't seem to find an answer in any of the online resources.
>
> I have a string (like 40,000 with different length and number of
> components) of them i
Hello,
I am running into a problem and need some pointers on regexp_replace - I
can't seem to find an answer in any of the online resources.
I have a string (like 40,000 with different length and number of
components) of them in a field named "externalurl". I need to replace the
final "/" of the
Thank you both. Problem solved - worked perfectly.
On Wed, Dec 9, 2015 at 5:41 PM, Jerry Sievers
wrote:
> Christopher Molnar writes:
>
> > Hello,
> >
> > I am running into a problem and need some pointers on regexp_replace - I
> can't seem to find an answer in any of the online resources.
> >
>
Christopher Molnar writes:
> Hello,
>
> I am running into a problem and need some pointers on regexp_replace - I
> can't seem to find an answer in any of the online resources.
>
> I have a string (like 40,000 with different length and number of components)
> of them in a field named "externalur
Christopher Molnar writes:
> I have a string (like 40,000 with different length and number of
> components) of them in a field named "externalurl". I need to replace the
> final "/" of the string with "&file=" while preserving the filename and
> extension following the "/".
> The closest I can get
Hi,
I guess capture will help you look at
http://www.postgresql.org/docs/9.0/static/functions-matching.html
SELECT regexp_replace('http://test.com/test/testfile.php',
'^(.*)/(.*\.php)$', E'\\1&file=\\2', 'g')
2015-12-09 22:58 GMT+01:00 Christopher Molnar :
> Hello,
>
> I am running into a problem
Hello,
I am running into a problem and need some pointers on regexp_replace - I
can't seem to find an answer in any of the online resources.
I have a string (like 40,000 with different length and number of
components) of them in a field named "externalurl". I need to replace the
final "/" of the
Mike writes:
> Thanks with a bit of moving stuff about I think thats sorted it - in
> case anyone every needs it:
>SELECT
> query,
> trim(regexp_replace(
> regexp_replace(
> regexp_replace(query,'\/\*.+\*\/','','g'),
> '--[^\r\n]*', ' ', 'g')
> ,
Thanks with a bit of moving stuff about I think thats sorted it - in
case anyone every needs it:
SELECT
query,
trim(regexp_replace(
regexp_replace(
regexp_replace(query,'\/\*.+\*\/','','g'),
'--[^\r\n]*', ' ', 'g')
, '\s+', ' ', 'g')) as q
FROM publ
>
>Von: pgsql-general-ow...@postgresql.org
>[pgsql-general-ow...@postgresql.org]" im Auftrag von "Mike
>[m...@wolman.co.uk]
>Gesendet: Mittwoch, 28. Oktober 2015 20:04
>An: pgsql-general@postgresql.org
>Betreff: [GENERA
Hi,
I am trying to clean up the query field returned by the
pg_stat_statements extension and remove all comments.
Some of the queries in the query field contain comments like '-- some
comment' and also '/* c style comments */'
I have managed to strip off the '--' comments and also white spa
On 03/21/2013 06:25 PM, Tom Lane wrote:
Rob Sargent writes:
For fun I decided to install 9.2 and thought I would try my luck there.
Here's was I saw (apologies for the wide output).
<< simple update in place>>
update cms.segment_data
set text = regexp_replace(text,'(^.*)ns/acres/pathology
Rob Sargent writes:
> For fun I decided to install 9.2 and thought I would try my luck there.
> Here's was I saw (apologies for the wide output).
> << simple update in place>>
> update cms.segment_data
> set text = regexp_replace(text,'(^.*)ns/acres/pathology/dx/1.5(.*$)',
> E'\\1ns/acres/pat
On 03/18/2013 02:40 PM, Tom Lane wrote:
Rob Sargent writes:
On 03/18/2013 01:19 PM, Tom Lane wrote:
Rob Sargent writes:
On our 9.0.4[1] server my regexp_replace is a no-op, but on the 9.0.3[2]
test machine and my 9.1.2[3] dev box all is fine
AFAICS from the commit logs, there were no chan
Maybe we're barking up the wrong tree by suspecting the regex itself.
Perhaps the updates were suppressed by a trigger, or the transaction
rolled back instead of committing, or some such?
regards, tom lane
Barking mad, more like it. I had rolled back the execution of m
On 03/18/2013 02:40 PM, Tom Lane wrote:
Rob Sargent writes:
On 03/18/2013 01:19 PM, Tom Lane wrote:
Rob Sargent writes:
On our 9.0.4[1] server my regexp_replace is a no-op, but on the 9.0.3[2]
test machine and my 9.1.2[3] dev box all is fine
AFAICS from the commit logs, there were no chan
Rob Sargent writes:
> On 03/18/2013 01:19 PM, Tom Lane wrote:
>> Rob Sargent writes:
>>> On our 9.0.4[1] server my regexp_replace is a no-op, but on the 9.0.3[2]
>>> test machine and my 9.1.2[3] dev box all is fine
>> AFAICS from the commit logs, there were no changes affecting the regex
>> code
On 03/18/2013 01:19 PM, Tom Lane wrote:
Rob Sargent writes:
On our 9.0.4[1] server my regexp_replace is a no-op, but on the 9.0.3[2]
test machine and my 9.1.2[3] dev box all is fine
AFAICS from the commit logs, there were no changes affecting the regex
code between 9.0.3 and 9.0.4. I'm suspi
Rob Sargent writes:
> On our 9.0.4[1] server my regexp_replace is a no-op, but on the 9.0.3[2]
> test machine and my 9.1.2[3] dev box all is fine
AFAICS from the commit logs, there were no changes affecting the regex
code between 9.0.3 and 9.0.4. I'm suspicious that your data is
different on th
On our 9.0.4[1] server my regexp_replace is a no-op, but on the 9.0.3[2]
test machine and my 9.1.2[3] dev box all is fine
This is may statement
update cms.segment_data s
set text = regexp_replace(s.text,
'(^.*)ns/acres/pathology/dx/1.5(.*$)',
E'\\1ns/acres/pathology/dx/1.6\\2')
from
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
2010/3/10 Harald Fuchs :
> I've got a problem with regexp_replace which I could reduce to the following:
>
> CREATE FUNCTION digest(text, text) RETURNS bytea
> LANGUAGE c IMMUTABLE STRICT
> AS '$libdir/pgcrypto', 'pg_digest';
>
> CREATE FUNCTION sha224enc(text) RETURNS text AS $$
> BEG
I've got a problem with regexp_replace which I could reduce to the following:
CREATE FUNCTION digest(text, text) RETURNS bytea
LANGUAGE c IMMUTABLE STRICT
AS '$libdir/pgcrypto', 'pg_digest';
CREATE FUNCTION sha224enc(text) RETURNS text AS $$
BEGIN
RAISE WARNING 'arg=»%«', $1
Just for clarity: In the documentation
(http://www.postgresql.org/docs/8.4/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP)
is mentioned "Flag g causes the function to find each match in the
string, not only the first one, and return a row for each such match. "
So in your example it was only
2010/2/27 :
> Hi!
>
> I am trying to replace characters '\r', '\n', or '\t' with space character '
> '. As an example, I want string "A\t\n\rB" becomes "AB". The following
> statement seems to be not working. What mistake have I made?
>
> TIA
>
> CN
>
>
> select regexp_replace(E'A\r\n\
Hi!
I am trying to replace characters '\r', '\n', or '\t' with space character ' '.
As an example, I want string "A\t\n\rB" becomes "AB". The following statement
seems to be not working. What mistake have I made?
TIA
CN
select regexp_replace(E'A\r\n\tB',E'[\r\n\t]',' ');
regexp_rep
Merlin Moncure wrote:
On Tue, Oct 28, 2008 at 10:42 AM, Vincas Dargis <[EMAIL PROTECTED]> wrote:
Hello everyone,
I have problem with regexp_replace ( PostgreSQL 8.3.1). Please try this
crappy string replacement:
select regexp_replace('[EMAIL PROTECTED]&^&*()[]-=', '[^0-9]*' ,'')
..and I ge
On Tue, Oct 28, 2008 at 10:42 AM, Vincas Dargis <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I have problem with regexp_replace ( PostgreSQL 8.3.1). Please try this
> crappy string replacement:
>
> select regexp_replace('[EMAIL PROTECTED]&^&*()[]-=', '[^0-9]*' ,'')
>
> ..and I get:
> "[EMAIL PR
Hello everyone,
I have problem with regexp_replace ( PostgreSQL 8.3.1). Please try this
crappy string replacement:
select regexp_replace('[EMAIL PROTECTED]&^&*()[]-=', '[^0-9]*' ,'')
..and I get:
"[EMAIL PROTECTED]&^&*()[]-="
So only thirst assurance where removed, while documentation states
Tom Lane wrote:
Marcus Engene <[EMAIL PROTECTED]> writes:
I would like to have a function like the above that returns "innan klas"
for this data. I would have expected it to as I use the non greedy version.
regression=# select
regexp_replace
('innan[noindex]apa[/noindex]klas[noind
Marcus Engene <[EMAIL PROTECTED]> writes:
> I would like to have a function like the above that returns "innan klas"
> for this data. I would have expected it to as I use the non greedy version.
regression=# select
regexp_replace
('innan[noindex]apa[/noindex]klas[noindex]banan[/noindex]',
Hi!
I'm using tsearch2 and sometimes there are blocks of text that shouldn't
be indexed.
There is a trigger function that gathers data from the usual suspects
and updates the index. in this trigger, I'd like to exclude thing in a
[noindex] tag:
select
regexp_replace
('innan[noindex]apa[
On Wednesday 11. June 2008, Leif B. Kristensen wrote:
>p := BTRIM(tmp, '#')::INTEGER;
>name := get_person_name(p);
>str := REPLACE(str, tmp, name);
I did some "folding" and replaced the above with
str := REPLACE(str, tmp, get_person_name(BTRIM(tmp, '#')::INTEGER));
and g
For the record: I've got two different flavors of those "shortlinks".
The first one, [p=123|John Smith] is the one that I started this thread
with. The second one is just a person number like [p=123] and should be
expanded to a similar link, with the default person name (fetched by
get_person_n
On Tuesday 10. June 2008, Michael Fuhr wrote:
>Something between my message and your shell appears to have converted
>a few spaces to no-break spaces. A hex dump of your query shows the
>following:
>
> 73 65 6c 65 63 74 20 72 65 67 65 78 70 5f 72 65 |select
> regexp_re| 0010 70 6c
CaT <[EMAIL PROTECTED]> writes:
> There's a bug in your version of pcre I think as postgres would have
> little to do with the regex itself (I be guessing).
You be wrong ... PG uses Tcl's regex engine, not pcre, and this behavior
is as documented. No, I don't know why Henry Spencer chose to do it
On Tue, Jun 10, 2008 at 03:43:02PM +0200, Leif B. Kristensen wrote:
> On Tuesday 10. June 2008, Leif B. Kristensen wrote:
> >Hey, I told it not to be greedy, didn't I?
>
> Found it. I must make *both* atoms non-greedy:
That makes no sense. Take this bit of perl, which works as expected:
$str = '
On Tuesday 10. June 2008, CaT wrote:
>On Tue, Jun 10, 2008 at 03:43:02PM +0200, Leif B. Kristensen wrote:
>> On Tuesday 10. June 2008, Leif B. Kristensen wrote:
>> >Hey, I told it not to be greedy, didn't I?
>>
>> Found it. I must make *both* atoms non-greedy:
>
>That makes no sense. Take this bit
On Tue, Jun 10, 2008 at 07:41:53AM -0600, Michael Fuhr wrote:
> On Tue, Jun 10, 2008 at 02:59:53PM +0200, Leif B. Kristensen wrote:
> > So far, so good. But look here:
> >
> > pgslekt=> select link_expand('[p=123|John Smith] and [p=456|Jane Doe]');
> > link_expand
> >
On Tuesday 10. June 2008, Leif B. Kristensen wrote:
>Hey, I told it not to be greedy, didn't I?
Found it. I must make *both* atoms non-greedy:
pgslekt=> CREATE OR REPLACE FUNCTION link_expand(TEXT) RETURNS TEXT AS
$$
SELECT REGEXP_REPLACE($1,
E'\\[p=(\\d+?)\\|(.+?)\\]',
E
On Tue, Jun 10, 2008 at 02:59:53PM +0200, Leif B. Kristensen wrote:
> So far, so good. But look here:
>
> pgslekt=> select link_expand('[p=123|John Smith] and [p=456|Jane Doe]');
> link_expand
> ---
>
On Tue, Jun 10, 2008 at 02:25:44PM +0200, Leif B. Kristensen wrote:
> Thank you Michael, I figured it was something fishy with the escaping.
> When I try your example, I get
>
> pgslekt=> select regexp_replace(
> pgslekt(> '[p=1242|John Smith]',
> pgslekt(> e'\\[p=(\\d+)\\|(.+?)\\]',
> pgsle
I put the code into a function, link_expand():
CREATE OR REPLACE FUNCTION link_expand(TEXT) RETURNS TEXT AS $$
SELECT REGEXP_REPLACE($1,
E'\\[p=(\\d+)\\|(.+?)\\]',
E'\\2', 'g');
$$ LANGUAGE sql STABLE;
pgslekt=> select link_expand('[p=123|John Smith]');
On Tuesday 10. June 2008, Michael Fuhr wrote:
>Parts of the regular expression need more escaping. Try this:
>
>select regexp_replace(
> '[p=1242|John Smith]',
> e'\\[p=(\\d+)\\|(.+?)\\]',
> e'\\2'
>);
>
> regexp_replace
>---
> J
On Tue, Jun 10, 2008 at 01:28:06PM +0200, Leif B. Kristensen wrote:
> I want to transform the text '[p=1242|John Smith]' to
> John Smith, but what I get is:
>
> pgslekt=> select REGEXP_REPLACE('[p=1242|John Smith]',
> pgslekt(> E'[p=(\d+)|(.+?)]',
> pgslekt(> E'\\2');
> regexp
I want to transform the text '[p=1242|John Smith]' to
John Smith, but what I get is:
pgslekt=> select REGEXP_REPLACE('[p=1242|John Smith]',
pgslekt(> E'[p=(\d+)|(.+?)]',
pgslekt(> E'\\2');
regexp_replace
--
[=1242|John Smith
On Thursday 8 May 2008 Tom Lane's cat, walking on the keyboard, wrote:
> Maybe the original strings had more than one instance of 'TIF'?
Opsyou're right, I've checked with a backup copy and I found four records
with the double tif pattern.
I should have get it beforesorry!
Luca
--
Sent
Luca Ferrari <[EMAIL PROTECTED]> writes:
> I used the regexp_replace function to make a substitution over a table, but I
> got a strange behaviour (please consider I'm not an expert of regex). The
> idea is to remove the final part of a code, that could be TIF, ISTTIF, tif,
> isttif, and at the
Hi all,
I used the regexp_replace function to make a substitution over a table, but I
got a strange behaviour (please consider I'm not an expert of regex). The
idea is to remove the final part of a code, that could be TIF, ISTTIF, tif,
isttif, and at the same time consider only the records depen
Abhijeet <[EMAIL PROTECTED]> writes:
> I have tried following regex in & function:
>- SELECT regexp_replace('Abhijeet',
>
> '<(\s)*/?(?i:script|i|b|u|embed|object|a|frameset|frame|iframe|meta|link|style|table|th|td|tr|tbody|input|select|option|form|map|area|!--)(.|\n)*?>',
>'\&\s');
I
On Nov 14, 2007 7:53 AM, Abhijeet <[EMAIL PROTECTED]> wrote:
> Hi,
>
> regexp_replace() function in new version of PostgreSQL is giving error.
>
> I am trying to remove tags from string.
>
> I have tried following regex in & function:
>
> SELECT regexp_replace('Abhijeet',
> '<(\s)*/?(?i:script|i|b|
Hi,
regexp_replace() function in new version of PostgreSQL is giving error.
I am trying to remove tags from string.
I have tried following regex in & function:
- SELECT regexp_replace('Abhijeet',
'<(\s)*/?(?i:script|i|b|u|embed|object|a|frameset|frame|iframe|meta|link|style|table|th|td|t
On Jul 23, 2007, at 9:50 AM, [EMAIL PROTECTED] wrote:
fieldname=regexp_replace(fieldname,old_sub_string,new_sub_string)
Add a 'g' flag:
fieldname=regexp_replace(fieldname,old_sub_string,new_sub_string, 'g')
From the end of a paragraph in 9.7.3 just before 9.7.3.1:
The flags parameter is an o
On Mon, Jul 23, 2007 at 07:50:35AM -0700, [EMAIL PROTECTED] wrote:
> I would like to change a sub-string in a text-field by using
>
> UPDATE tablename SET
> fieldname=regexp_replace(fieldname,old_sub_string,new_sub_string)
> WHERE (fieldname like '%old_sub_string%')
>
> In priniciple, it works. H
am Mon, dem 23.07.2007, um 7:50:35 -0700 mailte [EMAIL PROTECTED] folgendes:
> Hi all,
>
> I would like to change a sub-string in a text-field by using
>
> UPDATE tablename SET
> fieldname=regexp_replace(fieldname,old_sub_string,new_sub_string)
> WHERE (fieldname like '%old_sub_string%')
>
> I
Hi all,
I would like to change a sub-string in a text-field by using
UPDATE tablename SET
fieldname=regexp_replace(fieldname,old_sub_string,new_sub_string)
WHERE (fieldname like '%old_sub_string%')
In priniciple, it works. However, only one occurence of old_sub_string
is replaced and further not
68 matches
Mail list logo