Re: Replacing Ordinal Suffixes - Mailing list pgsql-general

From James Cloos
Subject Re: Replacing Ordinal Suffixes
Date
Msg-id m31tymvlfz.fsf@carbon.jhcloos.org
Whole thread Raw
In response to Re: Replacing Ordinal Suffixes  ("George Weaver" <gweaver@shaw.ca>)
List pgsql-general
>>>>> "GW" == George Weaver <gweaver@shaw.ca> writes:

GW> SELECT REGEXP_REPLACE(LOWER('300 North 126th Street'),
GW> E'(\d)(st|nd|rd|th)', E'\1', 'g');
GW>     regexp_replace
GW> ------------------------
GW> 300 north 126th street
GW> (1 row)

The E'' syntax eats your backslashes.  For that version, try just:

SELECT REGEXP_REPLACE(LOWER('300 North 126th Street'),'(\d)(st|nd|rd|th)', '\1', 'g');

-JimC
--
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6

pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: Re: Moving data from M$ JetDB file to Postgres on Linux
Next
From: Adrian Klaver
Date:
Subject: Re: Moving data from M$ JetDB file to Postgres on Linux