Re: [Koha] Regexp in MARC modification action
Excerpts from Jonathan Druart's message of 2017-11-26 16:45:08 +: > The "ig" in the modifiers input is a placeholder, not the default. > It is displayed as it to let you know 'i' and/or 'g' are possible modifiers. > Please try again explicitly specifying "ig" in the input box and it should > work. Thanks, that worked. I was confused by the faint gray "ig" in the input box because I thought that field wasn't editable. ___ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
Re: [Koha] Regexp in MARC modification action
The "ig" in the modifiers input is a placeholder, not the default. It is displayed as it to let you know 'i' and/or 'g' are possible modifiers. Please try again explicitly specifying "ig" in the input box and it should work. On Wed, 22 Nov 2017 at 16:48 Mark Alexanderwrote: > I'm trying to use a MARC modification template to fix the 952$d field > in MARC records we receive from our library supply house. This field > is supposed to be the acquisition date, but is coming to us in the > format /MM/DD instead of the required -MM-DD. So I needed to > find a way to replace the slashes with dashes. > > I created a MARC modification template with a simple action that uses > the regular expression s/\//-/ig. The UI for creating the action in > Koha implies that the "ig" modifiers are always used (though there > doesn't seem to be any way to change them). My understanding of the > "g" modifier in Perl is that it causes the s// operator to "replace > globally, that is, all occurrences". (This is a quote from an old > copy of "Programming Perl" by Wall et. al.) > > Yet it doesn't seem that the "g" modifier is really being used. When > I used this template on an imported MARC record, it changed the first > slash in 952$d, but not the second one. So, for example, 2017/11/06 > got changed to 2017-11/06. I had to add a second action to the > template, identical to the first action, to cause the second slash to be > replaced. > > Am I misunderstanding the use of regular expressions in MARC > modification templates, and in particular the behavior of the "g" > modifier? Or is this a possible bug? > ___ > Koha mailing list http://koha-community.org > Koha@lists.katipo.co.nz > https://lists.katipo.co.nz/mailman/listinfo/koha > ___ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
[Koha] Regexp in MARC modification action
I'm trying to use a MARC modification template to fix the 952$d field in MARC records we receive from our library supply house. This field is supposed to be the acquisition date, but is coming to us in the format /MM/DD instead of the required -MM-DD. So I needed to find a way to replace the slashes with dashes. I created a MARC modification template with a simple action that uses the regular expression s/\//-/ig. The UI for creating the action in Koha implies that the "ig" modifiers are always used (though there doesn't seem to be any way to change them). My understanding of the "g" modifier in Perl is that it causes the s// operator to "replace globally, that is, all occurrences". (This is a quote from an old copy of "Programming Perl" by Wall et. al.) Yet it doesn't seem that the "g" modifier is really being used. When I used this template on an imported MARC record, it changed the first slash in 952$d, but not the second one. So, for example, 2017/11/06 got changed to 2017-11/06. I had to add a second action to the template, identical to the first action, to cause the second slash to be replaced. Am I misunderstanding the use of regular expressions in MARC modification templates, and in particular the behavior of the "g" modifier? Or is this a possible bug? ___ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha