Re: syntax error in plperl wrapper for Perl regex replace.
От | io.sys |
---|---|
Тема | Re: syntax error in plperl wrapper for Perl regex replace. |
Дата | |
Msg-id | 20180824033249.771b45f5@aps.gogo обсуждение исходный текст |
Ответ на | syntax error in plperl wrapper for Perl regex replace. ("io.sys" <io.sys@post.cz>) |
Ответы |
Re: syntax error in plperl wrapper for Perl regex replace.
|
Список | pgsql-novice |
William, Thank you for your reply. I am familiar with "s" command of sed and with regular expressions in general. However, I am not familiar with Perl. My attempt to use the "s" command in my function is exactly the way you describe, i.e: s/regex_to_match/replacement-string-referencing-captured-groups/optional-options I just tried to use function parameters $_[1], $_[2], $_[3] instead fixed strings. However, it is rejected by postgre as syntax error. Why? Must be some trivial, novice error. R.Golis. #################################### On Thu, 23 Aug 2018 17:05:51 -0400, William Jackson <wtjack3@gmail.com> wrote: > The correct syntax for Perl regex substitutions is > > s/pattern_to_match/string_to_replace_matches_with/ > > After the third slash, you may add a single letter to indicate special > options, like g for global (matches however many times the pattern occurs > in the string) or i for case insensitivity. However, you may at most have > three of those slashes in your expression, with one substitution at a time. > There are ways to do multiple substitutions by using the default variables > for pattern matches, but it might be beyond the scope of your > time/usefulness. You may still want to have a look at > https://perldoc.perl.org/perlretut.html for details. > > -WTJ
В списке pgsql-novice по дате отправления: