I have another csv file where I am trying to do a simple word filter. For example, my text.csv file looks something like this:
name, age, hobbies
Tom, 8, \"
It's probably worth noting here that PHP has CSV handling libraries.
http://php.net/manual/en/function.fgetcsv.php
This returns the next line of the CSV as an array e.g.
// csv file contains "col1,col2,col3"
// array = {'col1', 'col2', 'col3'}
$array = fgetcsv($csv);
Then you can simply use in_array() or a test on $array[column_number] to filter.
I'm not sure if using a regular expression on the line string vs. using array search functions would be faster though, so it's probably worth testing.