Subject: | |
From: | |
Reply To: | |
Date: | Sun, 16 May 2010 21:04:12 -0500 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On Sunday, May 16, 2010 8:34 PM, Lisa Stienbarger [[log in to unmask]] wrote:
>I am not good with regular expressions, can a regular expression be created to copy just the date?
I don't know about doing it in MarcEdit, but in Perl, as part of comparing the 008, 050, and 260 dates, I use the following to parse out the 260$c date [1]:
######################
#extract 4 digit date portion
# account for [i.e. [date]]
unless ($wantedsubc =~ /\[i\..?e\..*(\d{4}).*?\]/) {
$wantedsubc =~ s/^.*?\b\D*(\d{4})\D*\b.*$/$1/;
}
else {$wantedsubc =~ s/.*?\[i\..?e\..*(\d{4}).*?\].*/$1/;
}
if ($wantedsubc =~ /^\d{4}$/) {$date260 = $wantedsubc;}
# i.e. date should be 2nd string of 4 digits
elsif ($wantedsubc =~ /^\d{8}$/) {$date260 = substr($wantedsubc,4,4);}
else {push @warningstoreturn, ("260: Unable to find 4 digit year in subfield 'c'."); return \@warningstoreturn;
}
###############
[1] <http://home.comcast.net/~eijabb/bryanmodules/MARC-Errorchecks-1.14/lib/MARC/Errorchecks.pm.txt> within "sub matchpubdates"
Alternate link: <http://search.cpan.org/~eijabb/MARC-Errorchecks-1.14/>
I hope this helps,
Bryan Baldus
Cataloger
Quality Books Inc.
The Best of America's Independent Presses
1-800-323-4241x402
[log in to unmask]
________________________________________________________________________
This message comes to you via MARCEDIT-L, a Listserv(R) list for technical and instructional support in MarcEdit. If you wish to communicate directly with the list owners, write to [log in to unmask] To unsubscribe, send a message "SIGNOFF MARCEDIT-L" to [log in to unmask]
|
|
|