I probably overdid all of it but hey it works. like this is what i'm taking in:
S=8x16,S=8x10&V=10-50
and ending up with
"5x11"=="8x16" || "5x11"=="8x10" && 6.3 >= 10 && 6.3 <= 50
which I will later eval()
heres the code. i'm so worried about something going wrong I don't take any shortcuts, i'm sure I didn't have to use a decimil for each number i'm sure there is a flag for any number but not sure it applies to double type numbers
$replace_arr = array('D' => $dia, 'L' => $len, 'V' => $volt, 'C' => $cap, 'R' => $ripple, 'E' => $esr, 'S' => $dia . 'x' . $len);
foreach($replace_arr AS $replace => $replace_with)
{
$str = str_replace($replace, $replace_with, $str);
}
$str = str_replace('&', ' && ', $str);
$str = preg_replace('/([0-9]{0,8}[\.]?[0-9]{0,8})[=]{1}([0-9]{0,8}[\.]?[0-9]{0,8})[-]{1}([0-9]{0,8}[\.]?[0-9]{0,8})/m', '$1 >= $2 && $1 <= $3', $str);
$str = preg_replace('/(?<!<|>)=/m', '==', $str);
$str = preg_replace('/([0-9]{0,8}[\.]?[0-9]{0,8})x([0-9]{0,8}[\.]?[0-9]{0,8})/m', "\"$1x$2\"", strtolower($str));
$str = str_replace(',', ' || ', $str);
print($str . "<br/>\n");