Re: syntax error in plperl wrapper for Perl regex replace.
В списке pgsql-novice по дате отправления:
| От | io.sys |
|---|---|
| Тема | Re: syntax error in plperl wrapper for Perl regex replace. |
| Дата | |
| Msg-id | 20180831060632.50f088e3@aps.gogo обсуждение исходный текст |
| Ответ на | syntax error in plperl wrapper for Perl regex replace. ("io.sys" <io.sys@post.cz>) |
| Список | pgsql-novice |
Hi, Cédric.
Works! Thank you very much for the hint. Apparently, you are much more
experienced with Perl, than me.
Just for reference, my working function wrapper for Perl regexp replace
now looks like this:
----------
create or replace function perl_regexp_replace (text, text, text, text)
returns text as $funcbody$
$_=$_[0];
eval "s/$_[1]/$_[2]/$_[3]";
return $_;
$funcbody$ language plperl immutable strict;
----------
Regards, Roman.
####################################
On Thu, 30 Aug 2018 11:20:49 +0200, Cédric Godin <cedric.godin@skynet.be>
wrote:
> Not being a perl expert either I think the problem lies in the regex
> line. You should eval it to have the expected result (and you can use
> your 4th parameter again then).
>
> eval "s/$_[1]/$_[2]/$_[3]";
>
> Regards, Cédric
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера