Re: BUG #15069: group by after regexp_replace - Mailing list pgsql-bugs

From Andrew Gierth
Subject Re: BUG #15069: group by after regexp_replace
Date
Msg-id 87fu62qngv.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to BUG #15069: group by after regexp_replace  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
>>>>> "PG" == PG Bug reporting form <noreply@postgresql.org> writes:

 PG>     select upper(regexp_replace(a, '\\s+', '')) as keyword

This regexp doesn't do what you seem to be expecting. With
standard_conforming_strings enabled, which is the default, \ is not a
special character to the string literal parser, so the regexp engine is
seeing a regexp of \\s+ which means "match the literal character \
followed by one or more lowercase "s" characters". Accordingly the
regexp never matches on your input.

To remove whitespace use '\s+' or E'\\s+' or '[[:space:]]+'

-- 
Andrew (irc:RhodiumToad)


pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #15069: group by after regexp_replace
Next
From: Dan Goodliffe
Date:
Subject: Re: BUG #15063: Updates to temporary tables fail when there is apublication with FOR ALL TABLES