From 1870f7b0c479ad0c97cf370fbe1eaad83de06b39 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 21 Nov 2022 21:37:44 +0000 Subject: [PATCH] Bug 30358 (follow-up) Simplify regex The regex does the following: 1. Replace newlines and carriage returns with a space 2. Replace leading and trailing whitespace with nothing (strip) --- Koha/MetadataRecord.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/MetadataRecord.pm b/Koha/MetadataRecord.pm index a1a54c2613d..bb7ec62be09 100644 --- a/Koha/MetadataRecord.pm +++ b/Koha/MetadataRecord.pm @@ -125,7 +125,7 @@ sub stripWhitespaceChars { my $key = $subfield->[0]; my $value = $subfield->[1]; $value =~ s/[\n\r]+/ /g; - $value =~ s/^\s+|\s+$|^\t+|\t+$//g; + $value =~ s/^\s+|\s+$//g; $field->add_subfields( $key => $value ); # add subfield to the end of the subfield list $field->delete_subfield( pos => 0 ); # delete the subfield at the top of the subfield list } -- 2.20.1