From 142fe277526162aeb8668bf678f10c01a8a82ff3 Mon Sep 17 00:00:00 2001 From: David Maus <maus@hab.de> Date: Fri, 27 Oct 2017 08:32:56 +0200 Subject: [PATCH] Allow multiple whitespace characters after field tag * src/HAB/Pica/Parser/PicaPlainParser.php (parseField): Allow multiple whitespace characters after field tag. --- README.org | 2 +- src/HAB/Pica/Parser/PicaPlainParser.php | 4 ++-- tests/fixtures/single_record.pp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.org b/README.org index e480ca5..c0e7f2c 100644 --- a/README.org +++ b/README.org @@ -6,7 +6,7 @@ PicaReader provides classes for reading Pica+ records encoded in PicaXML and PicaPlain. -PicaReader is copyright (c) 2012-2016 by Herzog August Bibliothek Wolfenbüttel and released under the +PicaReader is copyright (c) 2012-2017 by Herzog August Bibliothek Wolfenbüttel and released under the terms of the GNU General Public License v3. * Installation diff --git a/src/HAB/Pica/Parser/PicaPlainParser.php b/src/HAB/Pica/Parser/PicaPlainParser.php index afd52ae..87c8b92 100644 --- a/src/HAB/Pica/Parser/PicaPlainParser.php +++ b/src/HAB/Pica/Parser/PicaPlainParser.php @@ -20,7 +20,7 @@ * * @package PicaReader * @author David Maus <maus@hab.de> - * @copyright Copyright (c) 2012 - 2016 by Herzog August Bibliothek Wolfenbüttel + * @copyright Copyright (c) 2012 - 2017 by Herzog August Bibliothek Wolfenbüttel * @license http://www.gnu.org/licenses/gpl.html GNU General Public License v3 */ @@ -38,7 +38,7 @@ class PicaPlainParser implements PicaPlainParserInterface { $field = array('subfields' => array()); $match = array(); - if (preg_match('#^([012][0-9]{2}[A-Z@])(/([0-9]{2}))? (\$.*)$#Du', $line, $match)) { + if (preg_match('#^([012][0-9]{2}[A-Z@])(/([0-9]{2}))?\s+(\$.*)$#Du', $line, $match)) { $field = array('tag' => $match[1], 'occurrence' => $match[3] ?: null, 'subfields' => $this->parseSubfields($match[4]));; diff --git a/tests/fixtures/single_record.pp b/tests/fixtures/single_record.pp index f486642..7851ab6 100644 --- a/tests/fixtures/single_record.pp +++ b/tests/fixtures/single_record.pp @@ -5,7 +5,7 @@ 001U $0utf8 001X $00 002@ $0Aau -003@ $0024836885 +003@ $0024836885 003O $aOCoLC$019095997$v2009-06-15 004A $03787307699$fDM 26.- 004A $03787307702$fDM 68.- -- GitLab