Regex backreferences and MARC modification templates in 3.14
Hi all, I'm pretty pumped about the marc mod templates, but I have one question. Has anyone been able to use regex backreferences? Or more broadly, is anyone using the mod templates to concatenate values? I'm trying to prepend a value to a subfield, but when I look at the modified marc in the staged records list, I keep getting a literal instead of a backreference. Lets say subfield contains the following: some-old-value If I run a move or copy action against it using regex, I would expect the following expression: s/(.+)/some-new-value--$1/ to result in the following output: some-new-value--some-old-value instead, I get: some-new-value--$1 Note: I've also tried using other capture group notation (\1 \g1) instead of the dollar sign and I still get a literal. Thanks! -- Jason Sherman Systems Librarian University of Science and Arts of Oklahoma 405.574.1340
Hi Jason, This is not possible yet, but I submitted an improvement for Marc modification templates on bug 11319. It will allow to do something like: replace '^' with 'BEGIN' and '$' with 'END' If 245$a contains 'title', you will be allow to add a rule as: copy field 245$a to 245$a using regex s/^/new_value/ Regards, Jonathan 2014-03-07 22:32 GMT+01:00 Jason Sherman <jsherman@usao.edu>:
Hi all,
I'm pretty pumped about the marc mod templates, but I have one question. Has anyone been able to use regex backreferences? Or more broadly, is anyone using the mod templates to concatenate values?
I'm trying to prepend a value to a subfield, but when I look at the modified marc in the staged records list, I keep getting a literal instead of a backreference.
Lets say subfield contains the following: some-old-value
If I run a move or copy action against it using regex, I would expect the following expression: s/(.+)/some-new-value--$1/
to result in the following output: some-new-value--some-old-value
instead, I get: some-new-value--$1
Note: I've also tried using other capture group notation (\1 \g1) instead of the dollar sign and I still get a literal.
Thanks!
-- Jason Sherman Systems Librarian University of Science and Arts of Oklahoma 405.574.1340 _______________________________________________ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz http://lists.katipo.co.nz/mailman/listinfo/koha
participants (2)
-
Jason Sherman -
Jonathan Druart