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

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

Return to bug 23873