regexp_replace

Поиск
Список
Период
Сортировка
От Andy Colson
Тема regexp_replace
Дата
Msg-id 5697FA5F.2020703@squeakycode.net
обсуждение исходный текст
Ответы Re: regexp_replace  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: regexp_replace  (John McKown <john.archie.mckown@gmail.com>)
Re: regexp_replace  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
Hi all.

This is not doing as I'd expected:

select regexp_replace('71.09.6.01.3', '(\d)[.-](\d)', '\1\2', 'g');

  regexp_replace
----------------
  71096.013
(1 row)

It acts the same with dashes:
select regexp_replace('71-09-6-01-3', '(\d)[.-](\d)', '\1\2', 'g');

  regexp_replace
----------------
  71096-013
(1 row)

I cannot use translate because there is other text in the field.  I'm
trying to strip masking characters from a parcel number in a larger text
field (for example:  "the parcel 12-34-56 has caught on fire")

I seem to be missing something, any hints?

I'm on PG 9.3.9 on Slackware64.

Thanks for your time,

-Andy


В списке pgsql-general по дате отправления:

Предыдущее
От: Nikhil
Дата:
Сообщение: Postgres BDR bdr_init_copy fails
Следующее
От: Tom Lane
Дата:
Сообщение: Re: regexp_replace