Re: [E] Re: Regexp_replace bug / does not terminate on long strings

2021-08-23 Thread Markhof, Ingolf
You are right, I also found the same behaviour when using e.g the UNIX sed command. Ingolf On Mon, Aug 23, 2021 at 4:24 PM Francisco Olarte wrote: > Ingolf: > > On Mon, Aug 23, 2021 at 2:39 PM Markhof, Ingolf > wrote: > > Yes, When I use (\1)? instead of (\1)+, the expression is evaluated > q

Re: [E] Re: Regexp_replace bug / does not terminate on long strings

2021-08-23 Thread Francisco Olarte
Ingolf: On Mon, Aug 23, 2021 at 2:39 PM Markhof, Ingolf wrote: > Yes, When I use (\1)? instead of (\1)+, the expression is evaluated quickly, > but it doesn't return what I want. Once a word is written, it is not subject > to matching again. i.e. > select regexp_replace( --> remove double entri

Re: [E] Re: Regexp_replace bug / does not terminate on long strings

2021-08-23 Thread Markhof, Ingolf
Argh... Yes, When I use (\1)? instead of (\1)+, the expression is evaluated quickly, but it doesn't return what I want. Once a word is written, it is not subject to matching again. i.e. select regexp_replace( --> remove double entries 'one,one,one,two,two,three,three', '([^,]+)(,\1)?($|,)

Re: [E] Re: Regexp_replace bug / does not terminate on long strings

2021-08-23 Thread Markhof, Ingolf
Right. Considering a longer sequence of a's, "(a*)\1" allows a wide variety of matches. But in fact, this is not what I was trying to use. I was more looking at "(a)\1*" which shall match exactly what "a+" matches. As matching is greedy, "(a)\1*" shall consume all a's in a sequence in one go, just

Re: [E] Re: Regexp_replace bug / does not terminate on long strings

2021-08-20 Thread Tom Lane
"Markhof, Ingolf" writes: > thank you very much for your reply. Actually, I was assuming all these > regular expressions are based on the same core implementation. They are not. There are at least three fundamentally different implementation technologies (DFA, NFA, hybrid). Friedl's "Mastering

Re: [E] Re: Regexp_replace bug / does not terminate on long strings

2021-08-20 Thread Markhof, Ingolf
Thank you very much for all your proposals! Ingolf == Verizon Deutschland GmbH - Sebrathweg 20, 44149 Dortmund, Germany - Amtsgericht Dortmund, HRB 14952 - Geschäftsführer: Detlef Eppig - Vorsitzender des Aufsichtsrats: France

Re: [E] Re: Regexp_replace bug / does not terminate on long strings

2021-08-20 Thread Markhof, Ingolf
Hi Tom, thank you very much for your reply. Actually, I was assuming all these regular expressions are based on the same core implementation. Interestingly, this doesn't seem to be true... I am also surprised that you say the (\1)+ subpattern is computationally expensive. Regular expressions are