require that second field in same line begins with letters
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 28 Nov 2011 12:39:49 +0000 (13:39 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 28 Nov 2011 12:39:56 +0000 (13:39 +0100)
This fixes corner case in which values in timestap with date and time
where time gets recognized as second value in same line

lib/H1/ZTEMSAN.pm

index a8b5a74..dd0c4f9 100644 (file)
@@ -36,13 +36,13 @@ sub parse {
                if ( $line =~ m/^(\S+)\s*:\s*(\S*.*?)\s*$/ ) {
                        my ($n,$v) = ($1,$2);
                        $n =~ s/\(.+\)//;
-                       if ( $v =~ s/\s+(\S+)\s*:\s*(\S*.*?)\s*$// ) {
+                       if ( $v =~ s/\s+([a-zA-Z]\S+)\s*:\s*(\S*.*?)\s*$// ) {
                                # strip second column
                                my ($n2,$v2) = ($1,$2);
                                $n2 =~ s/\(.+\)//;
                                $hash->{ $section . $n2 } = $v2;
                                warn "## $n2 = $v2\n";
-                       } elsif ( $v =~ s/(\d+)(\S+)\s*:\s*(\S*.*?)\s*$/$1/ ) { # numberField without space
+                       } elsif ( $v =~ s/(\d+)([a-zA-Z]\S+)\s*:\s*(\S*.*?)\s*$/$1/ ) { # numberField without space
                                # strip second column
                                my ($n2,$v2) = ($1,$2);
                                $n2 =~ s/\(.+\)//;