[Koha-patches] [PATCH] DDCN Split Regexp Refinements
Chris Nighswonger
cnighswonger at foundations.edu
Tue Sep 23 17:49:23 CEST 2008
Adjusting to allow:
1. a space between the prefix and call number
2. 'n.d.'
---
C4/Labels.pm | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/C4/Labels.pm b/C4/Labels.pm
index 6531164..343287b 100644
--- a/C4/Labels.pm
+++ b/C4/Labels.pm
@@ -974,15 +974,16 @@ sub split_ddcn {
$ddcn =~ s/\///g; # in theory we should be able to simply remove all segmentation markers and arrive at the correct call number...
$_ = $ddcn;
# ddcn example R220.3 H2793Z H32 c.2
- my @splits = m/^([A-Z]{0,3}) # R (OS, REF, etc. up do three letters)
- ([0-9]+\.[0-9]*) # 220.3
- \s? # space (not requiring anything beyond the call number)
- ([a-zA-Z0-9]*\.?[a-zA-Z0-9])# cutter number... maybe, but if so it is in this position (Z indicates literary criticism)
- \s? # space if it exists
- ([a-zA-Z]*\.?[0-9]*) # other indicators such as cutter for author of literary criticism in this example if it exists
- \s? # space if ie exists
- ([a-zA-Z]*\.?[0-9]*) # other indicators such as volume number, copy number, edition date, etc. if it exists
- /x;
+ my @splits = m/^([A-Z]{0,3}) # R -OS, REF, etc. up do three letters
+ \s? # allow for possible space here
+ (\d+\.?\d*) # 220.3
+ \s? # space -not requiring anything beyond the call number
+ ([a-zA-Z]*\.?[a-zA-Z0-9]*) # cutter number -maybe, but if so it is in this position -Z indicates literary criticism
+ \s? # space if it exists
+ ([a-zA-Z]*\.?[a-zA-Z0-9]*\.?) # other indicators such as cutter for author of literary criticism in this example if it exists
+ \s? # space if it exists
+ ([a-zA-Z]*\.?[0-9]*) # other indicators such as volume number, copy number, edition date, etc. if it exists
+ /x;
return @splits;
}
--
1.5.3.7
More information about the Koha-patches
mailing list