Escaping the $title in the regexes with \Q and \E to handle nested quantifiers
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
1b12d695a0
commit
c7215e7a93
1 changed files with 4 additions and 4 deletions
|
@ -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;";
|
||||
|
|
Loading…
Reference in a new issue