=================================================================== RCS file: /cvs/pta/pta_import.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -p -r1.3 -r1.4 --- pta/pta_import.pl 2020/11/02 19:36:53 1.3 +++ pta/pta_import.pl 2020/11/03 09:14:03 1.4 @@ -31,7 +31,7 @@ sub import_chase_credit_card { s/^(.*),\s+(\d+)\s+(\S+)// or die "$fn import parse error: $line"; my ($reg, $account, $booking) = ($1, $2, $3); - $reg =~ s/,,/,.*?/g; + $reg =~ s/(?:^|(?<=,))(?:$|(?=,))/[^,]*/g; $reg = qr/$reg/; push @compiled, $reg; $bookings{$reg} = $booking; @@ -52,7 +52,7 @@ sub import_chase_credit_card { if ($line =~ /$regex/) { $account = $accounts{$regex}; $booking = $bookings{$regex}; - next; + last; } } if ($booking eq "" || $account eq "") { @@ -80,5 +80,5 @@ chomp($firstLine = <>); if ($firstLine eq $chase_credit_card_header) { import_chase_credit_card; } else { - print "Undefined header\n"; + die "Undefined header: $firstLine"; }