I have code to split weights and cubics number and unit. for example 540ml to "540" and "ml" the number preg_match work fine, but the preg_match unit return in array only "m".
When i test online this regex work fine too. But i dont know why php return in arrays only first letter. I tried all regex for only letter but dont work.
preg_match("/.[0-9]*/", $string, $number);<br/>
preg_match("/[(ml)(g)(kg)(l)]{1,1}[(ml)(g)(kg)(l)]{0,1}/", $string, $unit);
Aucun commentaire:
Enregistrer un commentaire