Sorry about the delays, I've been out sick.
I'm trying to use preg_replace. It looks like it works just like preg_match, but it replaces the pattern with a specified replacement. Most likely im doing something wrong as I cannot get it to work. Is it possible it's not working because it's not getting a match?
$data = '123,124. 125';
$check1 = '/ /';
$replace1 = '';
$check2[0] = '/./';
$check2[1] = '/,/';
$check2[2] = '/?/';
$check2[3] = '/-/';
$check2[4] = '/:/';
$check2[5] = '/./';
$check2[6] = '/$/';
$check2[7] = '/;/';
$check2[8] = '/\'/';
$check2[9] = '/"/';
$replace2[0] = ', ';
$replace2[1] = ', ';
$replace2[2] = ', ';
$replace2[3] = ', ';
$replace2[4] = ', ';
$replace2[5] = ', ';
$replace2[6] = ', ';
$replace2[7] = ', ';
$replace2[8] = ', ';
$replace2[9] = ', ';
$d1 = preg_replace($check1, $replace1, $data);
echo = $d1.'<br />';
$d2 = preg_replace($check2, $replace2, $d1);
echo $d2;
Also, after reviewing what I need the application to do, I realized they will never have decimal points. So I can just make sure they are numbers by using preg_match('/[0-9]{3}/', $data) once I turn it into an array. So now my main concern is cleaning up the data if the user decides to butcher it. 😃