mercredi 31 août 2016

Group regex with fix part

$txt = "toto1 555.4545.555.999.7465.432.674";
$rgx = "/([\w]+)\s([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/";
preg_match($rgx, $txt, $res);
var_dump($res);

I would like to simplify this pattern by avoiding repeating "([0-9]+)" because i don't know how many they are.

Any one can say me how ?

Aucun commentaire:

Enregistrer un commentaire