Array replace patterns

Regular expresions with arrays

I had to sanitize a csv file, where a column could contain a separatoer character inside, for example:
field3 needs to be sanitized, it has a semicolon inside, see?
The idea is to create an array where the keys are the patterns, the values are desired the replacement string

        // Replace patterns array: separators between two double quotes
         $patterns = array (
            '/(\".*)(;)(.*\")/is' => '${1}${3}',     // semicolon
            '/(\".*)(\|)(.*\")/is' => '${1}${3}',    // pipe
            '/(\".*)(,)(.*\")/is' => '${1}${3}',     // comma
            '/(\".*)(\\t)(.*\")/is' => '${1}${3}',   // tab