From 940ba379c189e64d9b4e4a1b8b8f7583dec9cfca Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 11 Apr 2013 12:48:26 +0200 Subject: [PATCH] Bug 8896 QA Followup for regex Content-Type: text/plain; charset=utf-8 Making sure that the regex does not kill more than it should. Here are my test results when removing serialseq 3 :) 3 => 3 => 3; => 1;3 => 1 1; 3 => 1 1; 3; => 1 3;1 => 1 3; 1 => 1 3 ;1 => 1 3 ; 1 => 1 1;3;31 => 1;31 1;3 ;31 => 1;31 1;3; 31 => 1;31 1; 3;31 => 1;31 2;3;31;; ;,, ;;,, ,;,;,;4 => 2;31;4 Signed-off-by: Marcel de Rooy --- C4/Serials.pm | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 784916c..35d4cd5 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1140,7 +1140,11 @@ sub ModSerialStatus { } # in case serial has been previously marked as missing if (grep /$status/, (1,2,3,7)) { - $missinglist =~ s/[,;]?\s?$serialseq//g; + #delete e.g. 3 not 31: therefore check on punct. and \D + $missinglist =~ s/(^|\s|[,;])$serialseq(?=\D|$)//g; + #cleanup the ; mess :) + $missinglist =~ s/[,;\s]+/;/g; + $missinglist =~ s/^[,;\s]+|[,;\s]+$//; } # warn "missinglist : $missinglist serialseq :$serialseq, ".index("$missinglist","$serialseq"); $missinglist .= "; $serialseq" -- 1.7.7.6