#! perl use strict; use warnings; use Text::CSV; my $csv = Text::CSV->new ( { sep_char => ',', binary => 1, auto_diag => 1, allow_loose_quotes => 1 } ); while (my $row = $csv->getline(*DATA)) { my $notesField = $row->[25]; if (defined $notesField) { print "\nNotes field: |$notesField|\n\n"; if ($notesField =~ /First Name:(.*?)(?=Last)/) { print "MATCHED!: '$1'\n"; } } else { print "No Notes Field\n\n"; } } $csv->error_diag() unless $csv->eof; __DATA__ ,,,,,,,,,,,,,,,,,,,,,,,,,"First Name: Dobbin Last Name: David L. Address: david@adamsonanddobbin.com City: PO Box 1326407 Pido Road State: Peterborough ZIP Code: ON Country: K9J 7H5 First Name: Dobbin Last Name: David L. E-mail: david@adamsonanddobbin.com Address: PO Box 1326407 Pido Road City: Peterborough State: ON ZIP Code: K9J 7H5",,,,,,Home,743 7790,Other,742 4524,Work,745 5751,,,,,,,,,,,Adamson And Dobbin Ltd. Mechanical Contractors,,General Manager,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,"First Name: Chapleau Last Name: Kathy, Ken Address: 666 FrankFirst Name: Chapleau Last Name: Kathy, Ken City: 666 Frank ",,,,,,Home,876-9863,,,,,,,,,,,,,,,Admiralty Hall,,Accountant,,,,,,,,,,,