Re: Replacing Ordinal Suffixes

From: Steve Atkins <steve(at)blighty(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Replacing Ordinal Suffixes
Date: 2014-02-28 23:04:32
Message-ID: 46F3F610-ED0E-489E-A5C8-5A4A3AF1A5A8@blighty.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Feb 28, 2014, at 2:43 PM, George Weaver <gweaver(at)shaw(dot)ca> wrote:

> From: Steve Atkins
>
> >Maybe this?
>
> >select regexp_replace('300 North 126th Street', '(\d+)(?:st|nd|rd|th)',
> >'\1', 'gi');
>
> Hi Steve,
>
> Thanks, but no luck:
>
> select regexp_replace('300 North 126th Street', E'(\d+)(?:st|nd|rd|th)',
> E'\1', 'gi');
> regexp_replace
> ------------------------
> 300 North 126th Street
>
> George

Those E’s you added completely change the meaning. If you want to
use E-style literals (and you probably don’t) you’ll need to double the
backslashes in all the strings.

Cheers,
Steve

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message George Weaver 2014-02-28 23:16:22 Re: Replacing Ordinal Suffixes
Previous Message George Weaver 2014-02-28 22:43:36 Re: Replacing Ordinal Suffixes