I need help. I want to ignore the comma in a specific line. This is a comma-separated csv file, but the name has a comma, and I need to ignore it.
I got
<?php $pattern = '/([\\W,\\s]+Inc.])|[,]/'; $subject = 'hypertext language, programming, Amazon, Inc., 100'; $limit = -1; $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE; $result = preg_split ($pattern, $subject, $limit, $flags); ?>
Result
$result (php code): <?php array ( 0 => 'hypertext language', 1 => ' programming', 2 => ' Amazon', 3 => ' Inc.', 4 => ' 100', ); ?>
And I want the result to be
$result (php code): <?php array ( 0 => 'hypertext language', 1 => ' programming', 2 => ' Amazon, Inc.', 3 => ' 100', ); ?>
Thank you for your help:)
source share