Re: regexp_replace

Поиск
Список
Период
Сортировка
От Andy Colson
Тема Re: regexp_replace
Дата
Msg-id 56980034.4080306@squeakycode.net
обсуждение исходный текст
Ответ на Re: regexp_replace  (John McKown <john.archie.mckown@gmail.com>)
Список pgsql-general
On 1/14/2016 2:02 PM, John McKown wrote:
> How about:
>
> select regexp_replace('71.09.6.01.3', '(\d)[.-]', '\1', 'g');
>
> match is 1.3 and result is 13 ( 71096.013). If you don't want to
> eliminate the period or dash unless it is _between_ two digits, try:
>
> select regexp_replace('71.09.6.01.3', '(\d)[.-](?=\d)', '\1', 'g');
>
> (?=\d) is a "look ahead") match which says that the period or dash must
> be followed by a digit, but the expression _does not_ "consume" the
> digit matched.
>
>
>
> Maranatha! <><
> John McKown

Yes, excellent, both seem to work.  I'll run a bunch of data through
them both and see what happens.

Thanks much for the help!

-Andy



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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: regexp_replace
Следующее
От: Andy Colson
Дата:
Сообщение: Re: regexp_replace