From c7215e7a93b3049907628b93d020fce267f2a6f3 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Wed, 2 Jan 2008 18:14:39 -0600 Subject: [PATCH] Escaping the $title in the regexes with \Q and \E to handle nested quantifiers Signed-off-by: Joshua Ferraro --- misc/migration_tools/rebuild_nozebra.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/misc/migration_tools/rebuild_nozebra.pl b/misc/migration_tools/rebuild_nozebra.pl index 1e53bfc835..9f5d10970c 100755 --- a/misc/migration_tools/rebuild_nozebra.pl +++ b/misc/migration_tools/rebuild_nozebra.pl @@ -131,9 +131,9 @@ while (my ($biblionumber) = $sth->fetchrow) { next unless $_; # skip empty values (multiple spaces) # remove any accented char # if the entry is already here, improve weight - 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;"; # otherwise, create it, with weight=1 } else { @@ -149,10 +149,10 @@ while (my ($biblionumber) = $sth->fetchrow) { foreach (split / /,$line) { next unless $_; # warn $record->as_formatted."$_ =>".$title; - if ($result{__RAW__}->{"$_"} =~ /$biblionumber,$title\-(\d);/) { + if ($result{__RAW__}->{"$_"} =~ /$biblionumber,\Q$title\E\-(\d);/) { my $weight=$1+1; # $weight++; - $result{__RAW__}->{"$_"} =~ s/$biblionumber,$title\-(\d);//; + $result{__RAW__}->{"$_"} =~ s/$biblionumber,\Q$title\E\-(\d);//; $result{__RAW__}->{"$_"} .= "$biblionumber,$title-$weight;"; } else { $result{__RAW__}->{"$_"}.="$biblionumber,$title-1;"; -- 2.39.5