Php preg_split用逗号分隔两个不同的数字

$line = "Type:Bid, End Time: 12/20/2018 08:10 AM (PST), Price: $8,000,Bids: 14, Age: 0, Description:  , Views: 120270, Valuation: $10,75, IsTrue: false";

I need to get this array:

Array ( [0] => Bid [1] => 12/20/2018 08:10 AM (PST) [2] => $8,000 [3] => 14 [4] => 0 [5] => [6] => 120270 [7] => $10,75 [8] => false )

much bettter idea:

$parts=explode(',',$line,4); //explode has a limit you can use in this case 4

same result less code.

I would keep it simple and do this

$line = "TRUE,59,m,10,500";
$parts = preg_split("/,/", $line);

//print_r ($parts);

$parts[3]=$parts[3].','.$parts[4]; //create a new part 3 from 3 and 4
//$parts[3].=','.$parts[4]; //alternative syntax to the above
unset($parts[4]);//remove old part 4
print_r ($parts);

i would also just use explode(), rather than a regular expression.

I'd use preg_match instead.
Here the pattern looks for digit(s) comma digit(s) or just digit(s) or a word and a comma.

I append a comma to the string to make the regex simpler.

$line = "TRUE,59,m,10,500";

preg_match_all("/(\d+,\d+|\d+|\w+),/", $line . ",", $match);
var_dump($match);

https://3v4l.org/HQMgu

Even with a different order of the items this code will still produce a correct output: https://3v4l.org/SRJOf

If a digit followed by a comma and a digit should not be splitted, you could match 1+ digits, repeat a grouping structure that matches a comma followed by 1+ digits and use SKIP FAIL to skip that match. Then use an alternation to match only a comma:

\d+(?:,\d+)+(*SKIP)(*F)|,

See the regex demo | Php demo

For example:

$line = "TRUE,59,m,10,500";
$parts = preg_split("/\d+(?:,\d+)+(*SKIP)(*F)|,/", $line);

echo '<table>';
foreach($parts as $parts){
    echo '<th>';
    echo ($parts);
    echo '</th>';
}
echo '<table>';

Result

<table><th>TRUE</th><th>59</th><th>m</th><th>10,500</th><table>

New answer according to new request:

I use he same regex for spliting the string and I replace after what is before the colon:

$line = "Type:Bid, End Time: 12/20/2018 08:10 AM (PST), Price: $8,000,Bids: 14, Age: 0, Description:  , Views: 120270, Valuation: $10,75, IsTrue: false";

$parts = preg_split("/(?<!\d),|,(?!\d)/", $line);
$result = array();
foreach($parts as $elem) {
    $result[] = preg_replace('/^[^:]+:\h*/', '', $elem);
}
print_r ($result);

Output:

Array
(
    [0] => Bid
    [1] => 12/20/2018 08:10 AM (PST)
    [2] => $8,000
    [3] => 14
    [4] => 0
    [5] => 
    [6] => 120270
    [7] => $10,75
    [8] => false
)