]> git.koha-community.org Git - koha.git/commit
Bug 29781: Enable capture groups in batch item modification
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 17 Jan 2022 13:38:28 +0000 (13:38 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 16 Feb 2022 21:51:11 +0000 (11:51 -1000)
commitbafd7cff70016d869e0bb7bc4048d5a45b0ccac2
treea5af1925e9fccdaffb4a51a0573a612f009c49b7
parent1516514f1ac8a8775582712b432d274cc975e65f
Bug 29781: Enable capture groups in batch item modification

This patch adds support for regular expression capture groups in
MarcModificationTemplates.

We escape double quotes in the replacement string, then quote the whole
string before applying the `ee` modifier to the final regex
application.

See https://blog.james.rcpt.to/2010/10/25/perl-search-and-replace-using-variables/
for further details.

Test plan
1) Attempt to use capture groups in your regular expression based
   batch item modification and note it does not work.
2) Apply the patch and try again, this time the capture group
   should yield the expected results.
3) Run t/SimpleMARC.t and confirm the tests still pass.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jo Hunter <jhunter@clicweb.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Items.pm