0

Sounds simple, but I can't seem to find the right regex formula to only allow numbers and periods in a string.

This is what I found, but gives me an error:

    if (!empty($get_version) && preg_match('^[0-9.]*$', $get_version)) {
      // Do something
    }
    else {
      // Get default value
    }
KeepCool
  • 497
  • 1
  • 6
  • 24

0 Answers0