Re: Replacing Ordinal Suffixes

From: James Cloos <cloos(at)jhcloos(dot)com>
To: "George Weaver" <gweaver(at)shaw(dot)ca>
Cc: "Paul Jungwirth" <pj(at)illuminatedcomputing(dot)com>, "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Replacing Ordinal Suffixes
Date: 2014-02-28 23:58:15
Message-ID: m31tymvlfz.fsf@carbon.jhcloos.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>>>> "GW" == George Weaver <gweaver(at)shaw(dot)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(at)jhcloos(dot)com> OpenPGP: 1024D/ED7DAEA6

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2014-02-28 23:58:16 Re: Moving data from M$ JetDB file to Postgres on Linux
Previous Message Adrian Klaver 2014-02-28 23:45:35 Re: Moving data from M$ JetDB file to Postgres on Linux