@ 2018-11-09T22:03:21Z <?php
$str = ' John David James (DEM) . . . . . . 7,808 10.51
Marvin D. Scott (DEM) . . . . . . 6,548 9.55
Maria "Mary" Williams (DEM) . . . . 4,551 8.58
Dwayne R. Johnson. . . . . . . . 4,322 8.22
WRITE-IN. . . . . . . . . . . 188 .29';
preg_match_all("/\s*(.*?)\s*\. \..*?([\d,]+)/", $str, $matches);
foreach($matches[1] as $key => $name){
$new[] = $name . "," . str_replace(",", "", $matches[2][$key]);
}
Var_dump($new);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.6.38 , 7.1.0 - 7.1.25 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.33 , 8.2.0 - 8.2.29 , 8.3.0 - 8.3.25 , 8.4.1 - 8.4.12 array(5) {
[0]=>
string(27) "John David James (DEM),7808"
[1]=>
string(26) "Marvin D. Scott (DEM),6548"
[2]=>
string(32) "Maria "Mary" Williams (DEM),4551"
[3]=>
string(22) "Dwayne R. Johnson,4322"
[4]=>
string(12) "WRITE-IN,188"
}
preferences:dark mode live preview ace vim emacs key bindings
139.2 ms | 408 KiB | 5 Q