vendredi 31 juillet 2015

How do I preg_match a certain string of numbers in a string [on hold]

This is probably pretty simple, but I can't seem to do it.

I need to pull out the 5.5.8 from this string:

XM.ar7240.v5.5.8.20795.140123.1700

Edit: My Regex is really rusty, so I really don't know where to start. I tried to count to the 12th position and then pull out the next 5 characters, but that didn't work at all.

    preg_match("/{0,12}[^*]/", $firmware_version, $matches);
  {
      print_r($matches);
  }

I was able to use this, but sometimes the version is 5.5.9, or 5.6.2, etc...

  preg_match("/5.5.8/", $firmware_version, $matches);
      {
          print_r($matches);
      }

Aucun commentaire:

Enregistrer un commentaire