Escaping the $title in the regexes with \Q and \E to handle nested quantifiers, cheers chris :)
Signed-off-by: Chris Cormack <crc@liblime.com> Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
2488749cdd
commit
0308eaad84
12
C4/Biblio.pm
12
C4/Biblio.pm
|
|
@ -2199,9 +2199,9 @@ sub _AddBiblioNoZebra {
|
|||
next unless $_; # skip empty values (multiple spaces)
|
||||
# if the entry is already here, improve weight
|
||||
# warn "managing $_";
|
||||
if ($result{$key}->{"$_"} =~ /$biblionumber,$title\-(\d);/) {
|
||||
if ($result{$key}->{"$_"} =~ /$biblionumber,\Q$title\E\-(\d);/) {
|
||||
my $weight=$1+1;
|
||||
$result{$key}->{"$_"} =~ s/$biblionumber,$title\-(\d);//;
|
||||
$result{$key}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d);//;
|
||||
$result{$key}->{"$_"} .= "$biblionumber,$title-$weight;";
|
||||
} else {
|
||||
# get the value if it exist in the nozebra table, otherwise, create it
|
||||
|
|
@ -2211,7 +2211,7 @@ sub _AddBiblioNoZebra {
|
|||
if ($existing_biblionumbers) {
|
||||
$result{$key}->{"$_"} =$existing_biblionumbers;
|
||||
my $weight=$1+1;
|
||||
$result{$key}->{"$_"} =~ s/$biblionumber,$title\-(\d);//;
|
||||
$result{$key}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d);//;
|
||||
$result{$key}->{"$_"} .= "$biblionumber,$title-$weight;";
|
||||
# create a new ligne for this entry
|
||||
} else {
|
||||
|
|
@ -2231,9 +2231,9 @@ sub _AddBiblioNoZebra {
|
|||
foreach (split / /,$line) {
|
||||
next unless $_; # skip empty values (multiple spaces)
|
||||
# if the entry is already here, improve weight
|
||||
if ($result{'__RAW__'}->{"$_"} =~ /$biblionumber,$title\-(\d);/) {
|
||||
if ($result{'__RAW__'}->{"$_"} =~ /$biblionumber,\Q$title\E\-(\d);/) {
|
||||
my $weight=$1+1;
|
||||
$result{'__RAW__'}->{"$_"} =~ s/$biblionumber,$title\-(\d);//;
|
||||
$result{'__RAW__'}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d);//;
|
||||
$result{'__RAW__'}->{"$_"} .= "$biblionumber,$title-$weight;";
|
||||
} else {
|
||||
# get the value if it exist in the nozebra table, otherwise, create it
|
||||
|
|
@ -2243,7 +2243,7 @@ sub _AddBiblioNoZebra {
|
|||
if ($existing_biblionumbers) {
|
||||
$result{'__RAW__'}->{"$_"} =$existing_biblionumbers;
|
||||
my $weight=$1+1;
|
||||
$result{'__RAW__'}->{"$_"} =~ s/$biblionumber,$title\-(\d);//;
|
||||
$result{'__RAW__'}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d);//;
|
||||
$result{'__RAW__'}->{"$_"} .= "$biblionumber,$title-$weight;";
|
||||
# create a new ligne for this entry
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue