]> git.koha-community.org Git - koha.git/commit
Bug 23873: Enable capture groups in MarcModificationTemplates
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 13 Dec 2021 09:59:15 +0000 (09:59 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 22 Feb 2022 01:15:47 +0000 (15:15 -1000)
commit0c155dd7b7370f2248fc7e3f56da43e8f2a37e18
tree52631013ba4a8429cb1671cfc1d67bd2601892d4
parent502a2b54830ce20e9cfb8e2bfc28b7933c69e35f
Bug 23873: Enable capture groups in MarcModificationTemplates

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
   MarcModificationTemplate 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: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/SimpleMARC.pm