RE: Regex problem with leader

[email protected] (Bryan Baldus)
Newsgroups perl.perl4lib
Message-ID <AE5353CC4A55324E832DA208826294AC898B3938C7@QBIMAIL.qbi.quality-books.com>
On  Monday, December 22, 2008 1:18 PM, Monday, December 22, 2008 1:18 PM wrote:
>However, if there is no language code, I want to assign the code "ENG".  The problem is my test for an empty language code is not working.  I've tried a few variants of the regex, but come up empty handed.  When I print out the empty language code it is just three blank spaces, but my regex isn't picking that up.  Any ideas would be greatly appreciated.<

In MARC::Errorchecks, sub validate008, I use:

    #get the values of the all-format positions
    my %field008hash = (
    dateentered => substr($field008,0,6),
    datetype => substr($field008,6,1),
    date1 => substr($field008,7,4),
    date2 => substr($field008,11,4),
    pubctry => substr($field008,15,3),
    ### format specific 18-34 ###
    langcode => substr($field008,35,3),
    modrec => substr($field008,38,1),
    catsource => substr($field008,39,1)
    );

#...

    #report new 'zxx' code when '   ' (3-blanks) is existing code
    if ($field008hash{langcode} eq '   ') {
        push @warningstoreturn, ("008: Bytes 35-37, Language ($field008hash{langcode}) must now be coded 'zxx' for No linguistic content.");
    } #if 008/35-37 is 3-blanks

#########################################

I hope this helps,

Bryan Baldus
[email protected]
[email protected]
http://home.inwave.com/eija
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.