View | Details | Raw Unified | Return to bug 23873
Collapse All | Expand All

(-)a/Koha/SimpleMARC.pm (-5 / +6 lines)
Lines 636-641 sub _modify_values { Link Here
636
    my $regex = $params->{regex};
636
    my $regex = $params->{regex};
637
637
638
    if ( $regex and $regex->{search} ) {
638
    if ( $regex and $regex->{search} ) {
639
        $regex->{replace} =~ s/"/\\"/g;                    # Protection from embedded code
640
        $regex->{replace} = '"' . $regex->{replace} . '"'; # Put in a string for /ee
639
        $regex->{modifiers} //= q||;
641
        $regex->{modifiers} //= q||;
640
        my @available_modifiers = qw( i g );
642
        my @available_modifiers = qw( i g );
641
        my $modifiers = q||;
643
        my $modifiers = q||;
Lines 645-660 sub _modify_values { Link Here
645
        }
647
        }
646
        foreach my $value ( @$values ) {
648
        foreach my $value ( @$values ) {
647
            if ( $modifiers =~ m/^(ig|gi)$/ ) {
649
            if ( $modifiers =~ m/^(ig|gi)$/ ) {
648
                $value =~ s/$regex->{search}/$regex->{replace}/ig;
650
                $value =~ s/$regex->{search}/$regex->{replace}/igee;
649
            }
651
            }
650
            elsif ( $modifiers eq 'i' ) {
652
            elsif ( $modifiers eq 'i' ) {
651
                $value =~ s/$regex->{search}/$regex->{replace}/i;
653
                $value =~ s/$regex->{search}/$regex->{replace}/iee;
652
            }
654
            }
653
            elsif ( $modifiers eq 'g' ) {
655
            elsif ( $modifiers eq 'g' ) {
654
                $value =~ s/$regex->{search}/$regex->{replace}/g;
656
                $value =~ s/$regex->{search}/$regex->{replace}/gee;
655
            }
657
            }
656
            else {
658
            else {
657
                $value =~ s/$regex->{search}/$regex->{replace}/;
659
                $value =~ s/$regex->{search}/$regex->{replace}/ee;
658
            }
660
            }
659
        }
661
        }
660
    }
662
    }
661
- 

Return to bug 23873