From 0308eaad84bf5fcbc34e27eac75f46f4fd4156ce Mon Sep 17 00:00:00 2001 From: Mason James Date: Wed, 9 Jan 2008 23:47:34 -0600 Subject: [PATCH] Escaping the $title in the regexes with \Q and \E to handle nested quantifiers, cheers chris :) Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Biblio.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 3c60dc1881..96a7c5bdca 100755 --- a/C4/Biblio.pm +++ b/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 { -- 2.39.5