[Koha] Regexp in MARC modification action

Jonathan Druart jonathan.druart at bugs.koha-community.org
Mon Nov 27 05:45:08 NZDT 2017


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 Alexander <marka at pobox.com> wrote:

> 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 YYYY/MM/DD instead of the required YYYY-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 at lists.katipo.co.nz
> https://lists.katipo.co.nz/mailman/listinfo/koha
>


More information about the Koha mailing list